Mercurial > mplayer.hg
annotate libvo/vo_xvmc.c @ 10693:7cf006b5a61c
sync
author | nauj27 |
---|---|
date | Mon, 25 Aug 2003 13:45:45 +0000 |
parents | 2cae82f2ab02 |
children | 7ab88b24cb81 |
rev | line source |
---|---|
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1 #include <stdlib.h> |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
2 #include <stdio.h> |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
3 #include <string.h> |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
4 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
5 #include <X11/Xlib.h> |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
6 #include <X11/Xutil.h> |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
7 #include <X11/Xatom.h> |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
8 #include <X11/extensions/Xv.h> |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
9 #include <X11/extensions/Xvlib.h> |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
10 #include <X11/extensions/XvMClib.h> |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
11 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
12 #include "config.h" |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
13 #include "mp_msg.h" |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
14 #include "video_out.h" |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
15 #include "video_out_internal.h" |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
16 #include "fastmemcpy.h" |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
17 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
18 #include "x11_common.h" |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
19 #include "xvmc_render.h" |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
20 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
21 #include "sub.h" |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
22 #include "aspect.h" |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
23 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
24 #ifdef HAVE_NEW_GUI |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
25 #include "../Gui/interface.h" |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
26 #endif |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
27 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
28 #undef HAVE_XINERAMA |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
29 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
30 #undef NDEBUG |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
31 #include <assert.h> |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
32 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
33 //no chanse xinerama to be suported in near future |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
34 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
35 #define UNUSED(x) ((void)(x)) |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
36 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
37 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
38 extern int vo_directrendering; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
39 extern int vo_verbose; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
40 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
41 static void xvmc_free(void); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
42 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
43 static int image_width,image_height; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
44 static uint32_t drwX,drwY; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
45 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
46 static XvPortID xv_port; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
47 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
48 //0-auto;1-backgound always keycolor;2-autopaint(by X);3-manual fill |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
49 static int keycolor_handling; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
50 static unsigned long keycolor; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
51 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
52 static XvMCSurfaceInfo surface_info; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
53 static XvMCContext ctx; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
54 static XvMCBlockArray data_blocks; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
55 static XvMCMacroBlockArray mv_blocks; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
56 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
57 #define MAX_SURFACES 8 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
58 static int number_of_surfaces=0; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
59 static XvMCSurface surface_array[MAX_SURFACES]; |
10452 | 60 static xvmc_render_state_t * surface_render; |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
61 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
62 static xvmc_render_state_t * p_render_surface_to_show=NULL; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
63 static xvmc_render_state_t * p_render_surface_visible=NULL; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
64 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
65 static vo_info_t info = { |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
66 "XVideo Motion Compensation", |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
67 "xvmc", |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
68 "Ivan Kalvachev <iive@users.sf.net>", |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
69 "" |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
70 }; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
71 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
72 LIBVO_EXTERN(xvmc); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
73 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
74 static void init_keycolor(){ |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
75 Atom xv_atom; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
76 XvAttribute * attributes; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
77 int colorkey; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
78 int rez; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
79 int attrib_count,i; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
80 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
81 keycolor=2110; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
82 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
83 if(keycolor_handling == 0){ |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
84 //XV_AUTOPING_COLORKEY doesn't work for XvMC yet(NVidia 43.63) |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
85 attributes = XvQueryPortAttributes(mDisplay, xv_port, &attrib_count); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
86 if(attributes!=NULL) |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
87 for (i = 0; i < attrib_count; i++) |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
88 if (!strcmp(attributes[i].name, "XV_AUTOPAINT_COLORKEY")) |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
89 { |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
90 xv_atom = XInternAtom(mDisplay, "XV_AUTOPAINT_COLORKEY", False); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
91 if(xv_atom!=None) |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
92 { |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
93 rez=XvSetPortAttribute(mDisplay, xv_port, xv_atom, 1); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
94 if(rez == Success) |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
95 keycolor_handling = 2;//this is the way vo_xv works |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
96 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
97 break; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
98 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
99 XFree(attributes); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
100 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
101 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
102 xv_atom = XInternAtom(mDisplay, "XV_COLORKEY",False); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
103 if(xv_atom == None) return; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
104 rez=XvGetPortAttribute(mDisplay,xv_port, xv_atom, &colorkey); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
105 if(rez == Success){ |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
106 keycolor=colorkey; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
107 if(keycolor_handling == 0){ |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
108 keycolor_handling = 3; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
109 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
110 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
111 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
112 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
113 //from vo_xmga |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
114 static void mDrawColorKey(uint32_t x,uint32_t y, uint32_t w, uint32_t h) |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
115 { |
10452 | 116 if( (keycolor_handling != 2) && (keycolor_handling != 3) ) |
10608 | 117 return ;//unknown method |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
118 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
119 XSetBackground( mDisplay,vo_gc,0 ); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
120 XClearWindow( mDisplay,vo_window ); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
121 |
10452 | 122 if(keycolor_handling == 3){ |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
123 XSetForeground( mDisplay,vo_gc,keycolor ); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
124 XFillRectangle( mDisplay,vo_window,vo_gc,x,y,w,h); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
125 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
126 XFlush( mDisplay ); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
127 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
128 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
129 // now it is ugly, but i need it working |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
130 static int xvmc_check_surface_format(uint32_t format, XvMCSurfaceInfo * surf_info){ |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
131 if ( format == IMGFMT_XVMC_IDCT_MPEG2 ){ |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
132 if( surf_info->mc_type != (XVMC_IDCT|XVMC_MPEG_2) ) return -1; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
133 if( surf_info->chroma_format != XVMC_CHROMA_FORMAT_420 ) return -1; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
134 return 0; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
135 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
136 if ( format == IMGFMT_XVMC_MOCO_MPEG2 ){ |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
137 if(surf_info->mc_type != XVMC_MPEG_2) return -1; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
138 if(surf_info->chroma_format != XVMC_CHROMA_FORMAT_420) return -1; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
139 return 0; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
140 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
141 return -1;//fail |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
142 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
143 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
144 // WARNING This function may changes xv_port and surface_info! |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
145 static int xvmc_find_surface_by_format(int format,int width,int height, |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
146 XvMCSurfaceInfo * surf_info,int query){ |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
147 int rez; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
148 XvAdaptorInfo * ai; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
149 int num_adaptors,i; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
150 unsigned long p; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
151 int s,mc_surf_num; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
152 XvMCSurfaceInfo * mc_surf_list; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
153 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
154 rez = XvQueryAdaptors(mDisplay,DefaultRootWindow(mDisplay),&num_adaptors,&ai); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
155 if( rez != Success ) return -1; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
156 if( verbose > 2 ) printf("vo_xvmc: Querying %d adaptors\n",num_adaptors); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
157 for(i=0; i<num_adaptors; i++) |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
158 { |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
159 if( verbose > 2) printf("vo_xvmc: Quering adaptor #%d\n",i); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
160 if( ai[i].type == 0 ) continue;// we need at least dummy type! |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
161 //probing ports |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
162 for(p=ai[i].base_id; p<ai[i].base_id+ai[i].num_ports; p++) |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
163 { |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
164 if( verbose > 2) printf("vo_xvmc: probing port #%ld\n",p); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
165 mc_surf_list = XvMCListSurfaceTypes(mDisplay,p,&mc_surf_num); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
166 if( mc_surf_list == NULL || mc_surf_num == 0){ |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
167 if( verbose > 2) printf("vo_xvmc: No XvMC supported. \n"); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
168 continue; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
169 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
170 if( verbose > 2) printf("vo_xvmc: XvMC list have %d surfaces\n",mc_surf_num); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
171 //we have XvMC list! |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
172 for(s=0; s<mc_surf_num; s++) |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
173 { |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
174 if( width > mc_surf_list[s].max_width ) continue; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
175 if( height > mc_surf_list[s].max_height ) continue; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
176 if( xvmc_check_surface_format(format,&mc_surf_list[s])<0 ) continue; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
177 //we have match! |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
178 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
179 if(!query){ |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
180 rez = XvGrabPort(mDisplay,p,CurrentTime); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
181 if(rez != Success){ |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
182 if (verbose > 2) printf("vo_xvmc: Fail to grab port %ld\n",p); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
183 continue; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
184 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
185 printf("vo_xvmc: Port %ld grabed\n",p); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
186 xv_port = p; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
187 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
188 goto surface_found; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
189 }//for mc surf |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
190 XFree(mc_surf_list);//if mc_surf_num==0 is list==NULL ? |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
191 }//for ports |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
192 }//for adaptors |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
193 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
194 if(!query) printf("vo_xvmc: Could not find free matching surface. Sorry.\n"); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
195 return 0; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
196 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
197 // somebody know cleaner way to escape from 3 internal loops? |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
198 surface_found: |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
199 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
200 memcpy(surf_info,&mc_surf_list[s],sizeof(XvMCSurfaceInfo)); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
201 if( verbose > 2 || !query) |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
202 printf("vo_xvmc: Found matching surface with id=%X on %ld port at %d adapter\n", |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
203 mc_surf_list[s].surface_type_id,p,i); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
204 return mc_surf_list[s].surface_type_id; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
205 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
206 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
207 static uint32_t xvmc_draw_image(mp_image_t *mpi){ |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
208 xvmc_render_state_t * rndr; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
209 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
210 assert(mpi!=NULL); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
211 assert(mpi->flags &MP_IMGFLAG_DIRECT); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
212 // assert(mpi->flags &MP_IMGFLAGS_DRAWBACK); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
213 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
214 rndr = (xvmc_render_state_t*)mpi->priv;//there is copy in plane[2] |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
215 assert( rndr != NULL ); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
216 assert( rndr->magic == MP_XVMC_RENDER_MAGIC ); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
217 if( verbose > 3 ) |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
218 printf("vo_xvmc: draw_image(show rndr=%p)\n",rndr); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
219 // the surface have passed vf system without been skiped, it will be displayed |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
220 rndr->state |= MP_XVMC_STATE_DISPLAY_PENDING; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
221 p_render_surface_to_show = rndr; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
222 return VO_TRUE; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
223 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
224 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
225 static uint32_t preinit(const char *arg){ |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
226 int xv_version,xv_release,xv_request_base,xv_event_base,xv_error_base; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
227 int mc_eventBase,mc_errorBase; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
228 int mc_ver,mc_rev; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
229 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
230 //Obtain display handler |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
231 if (!vo_init()) return -1;//vo_xv |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
232 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
233 //XvMC is subdivision of XVideo |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
234 if (Success != XvQueryExtension(mDisplay,&xv_version,&xv_release,&xv_request_base, |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
235 &xv_event_base,&xv_error_base) ){ |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
236 mp_msg(MSGT_VO,MSGL_ERR,"Sorry, Xv(MC) not supported by this X11 version/driver\n"); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
237 mp_msg(MSGT_VO,MSGL_ERR,"********** Try with -vo x11 or -vo sdl ***********\n"); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
238 return -1; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
239 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
240 printf("vo_xvmc: X-Video extension %d.%d\n",xv_version,xv_release); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
241 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
242 if( True != XvMCQueryExtension(mDisplay,&mc_eventBase,&mc_errorBase) ){ |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
243 printf("vo_xvmc: No X-Video MotionCompensation Extension on %s\n", |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
244 XDisplayName(NULL)); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
245 return -1; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
246 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
247 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
248 if(Success == XvMCQueryVersion(mDisplay, &mc_ver, &mc_rev) ){ |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
249 printf("vo_xvmc: X-Video MotionCompensation Extension version %i.%i\n", |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
250 mc_ver,mc_rev); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
251 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
252 else{ |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
253 printf("vo_xvmc: Error querying version info!\n"); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
254 return -1; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
255 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
256 xv_port = 0; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
257 number_of_surfaces = 0; |
10497
9e6becbd5c8a
draw rectangle with color key, avoid blue bars. avoid PutSurface before 1'st image
iive
parents:
10452
diff
changeset
|
258 keycolor_handling = 3;//!!fixme |
10452 | 259 surface_render=NULL; |
260 | |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
261 return 0; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
262 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
263 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
264 static uint32_t config(uint32_t width, uint32_t height, |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
265 uint32_t d_width, uint32_t d_height, |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
266 uint32_t flags, char *title, uint32_t format){ |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
267 int i,mode_id,rez; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
268 int numblocks,blocks_per_macroblock;//bpmb we have 6,8,12 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
269 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
270 //from vo_xv |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
271 char *hello = (title == NULL) ? "XvMC render" : title; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
272 XSizeHints hint; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
273 XVisualInfo vinfo; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
274 XGCValues xgcv; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
275 XSetWindowAttributes xswa; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
276 XWindowAttributes attribs; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
277 unsigned long xswamask; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
278 int depth; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
279 #ifdef HAVE_XF86VM |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
280 int vm=0; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
281 unsigned int modeline_width, modeline_height; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
282 static uint32_t vm_width; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
283 static uint32_t vm_height; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
284 #endif |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
285 //end of vo_xv |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
286 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
287 if( !IMGFMT_IS_XVMC(format) ) |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
288 { |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
289 assert(0);//should never happen, abort on debug or |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
290 return 1;//return error on relese |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
291 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
292 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
293 // Find free port that supports MC, by querying adaptors |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
294 if( xv_port != 0 || number_of_surfaces != 0 ){ |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
295 xvmc_free(); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
296 }; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
297 numblocks=((width+15)/16)*((height+15)/16); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
298 // Find Supported Surface Type |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
299 mode_id = xvmc_find_surface_by_format(format,width,height,&surface_info,0);//false=1 to grab port, not query |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
300 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
301 rez = XvMCCreateContext(mDisplay, xv_port,mode_id,width,height,XVMC_DIRECT,&ctx); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
302 if( rez != Success ) return -1; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
303 if( ctx.flags & XVMC_DIRECT ){ |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
304 printf("vo_xvmc: Allocated Direct Context\n"); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
305 }else{ |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
306 printf("vo_xvmc: Allocated Indirect Context!\n"); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
307 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
308 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
309 blocks_per_macroblock = 6; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
310 if(surface_info.chroma_format == XVMC_CHROMA_FORMAT_422) |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
311 blocks_per_macroblock = 8; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
312 if(surface_info.chroma_format == XVMC_CHROMA_FORMAT_444) |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
313 blocks_per_macroblock = 12; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
314 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
315 rez = XvMCCreateBlocks(mDisplay,&ctx,numblocks*blocks_per_macroblock,&data_blocks); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
316 if( rez != Success ){ |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
317 XvMCDestroyContext(mDisplay,&ctx); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
318 return -1; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
319 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
320 printf("vo_xvmc: data_blocks allocated\n"); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
321 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
322 rez = XvMCCreateMacroBlocks(mDisplay,&ctx,numblocks,&mv_blocks); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
323 if( rez != Success ){ |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
324 XvMCDestroyBlocks(mDisplay,&data_blocks); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
325 XvMCDestroyContext(mDisplay,&ctx); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
326 return -1; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
327 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
328 printf("vo_xvmc: mv_blocks allocated\n"); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
329 |
10452 | 330 if(surface_render==NULL) |
331 surface_render=malloc(MAX_SURFACES*sizeof(xvmc_render_state_t));//easy mem debug | |
332 | |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
333 for(i=0; i<MAX_SURFACES; i++){ |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
334 rez=XvMCCreateSurface(mDisplay,&ctx,&surface_array[i]); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
335 if( rez != Success ) |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
336 break; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
337 memset(&surface_render[i],0,sizeof(xvmc_render_state_t)); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
338 surface_render[i].magic = MP_XVMC_RENDER_MAGIC; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
339 surface_render[i].data_blocks = data_blocks.blocks; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
340 surface_render[i].mv_blocks = mv_blocks.macro_blocks; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
341 surface_render[i].total_number_of_mv_blocks = numblocks; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
342 surface_render[i].total_number_of_data_blocks = numblocks*blocks_per_macroblock;; |
10452 | 343 surface_render[i].mc_type = surface_info.mc_type & (~XVMC_IDCT); |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
344 surface_render[i].idct = (surface_info.mc_type & XVMC_IDCT) == XVMC_IDCT; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
345 surface_render[i].chroma_format = surface_info.chroma_format; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
346 surface_render[i].unsigned_intra = (surface_info.flags & XVMC_INTRA_UNSIGNED) == XVMC_INTRA_UNSIGNED; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
347 surface_render[i].p_surface = &surface_array[i]; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
348 if( verbose > 3 ) |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
349 printf("vo_xvmc: surface[%d] = %p .rndr=%p\n",i,&surface_array[i], &surface_render[i]); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
350 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
351 number_of_surfaces = i; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
352 if( number_of_surfaces < 4 ){// +2 I or P and +2 for B (to avoid visible motion drawing) |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
353 printf("vo_xvmc: Unable to allocate at least 4 Surfaces\n"); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
354 uninit(); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
355 return -1; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
356 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
357 printf("vo_xvmc: Motion Compensation context allocated - %d surfaces\n", |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
358 number_of_surfaces); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
359 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
360 //debug |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
361 printf("vo_xvmc: idct=%d unsigned_intra=%d\n", |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
362 (surface_info.mc_type & XVMC_IDCT) == XVMC_IDCT, |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
363 (surface_info.flags & XVMC_INTRA_UNSIGNED) == XVMC_INTRA_UNSIGNED); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
364 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
365 init_keycolor();// take keycolor value and choose method for handling it |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
366 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
367 //taken from vo_xv |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
368 panscan_init(); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
369 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
370 aspect_save_orig(width,height); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
371 aspect_save_prescale(d_width,d_height); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
372 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
373 image_height = height; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
374 image_width = width; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
375 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
376 vo_mouse_autohide = 1; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
377 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
378 vo_dx=( vo_screenwidth - d_width ) / 2; vo_dy=( vo_screenheight - d_height ) / 2; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
379 geometry(&vo_dx, &vo_dy, &d_width, &d_height, vo_screenwidth, vo_screenheight); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
380 vo_dwidth=d_width; vo_dheight=d_height; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
381 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
382 #ifdef HAVE_XF86VM |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
383 if( flags&0x02 ) vm = 1; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
384 #endif |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
385 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
386 aspect_save_screenres(vo_screenwidth,vo_screenheight); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
387 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
388 #ifdef HAVE_NEW_GUI |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
389 if(use_gui) |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
390 guiGetEvent( guiSetShVideo,0 ); // let the GUI to setup/resize our window |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
391 else |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
392 #endif |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
393 { |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
394 hint.x = vo_dx; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
395 hint.y = vo_dy; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
396 aspect(&d_width,&d_height,A_NOZOOM); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
397 hint.width = d_width; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
398 hint.height = d_height; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
399 #ifdef HAVE_XF86VM |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
400 if ( vm ) |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
401 { |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
402 if ((d_width==0) && (d_height==0)) |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
403 { vm_width=image_width; vm_height=image_height; } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
404 else |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
405 { vm_width=d_width; vm_height=d_height; } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
406 vo_vm_switch(vm_width, vm_height,&modeline_width, &modeline_height); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
407 hint.x=(vo_screenwidth-modeline_width)/2; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
408 hint.y=(vo_screenheight-modeline_height)/2; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
409 hint.width=modeline_width; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
410 hint.height=modeline_height; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
411 aspect_save_screenres(modeline_width,modeline_height); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
412 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
413 else |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
414 #endif |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
415 if ( vo_fs ) |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
416 { |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
417 #ifdef X11_FULLSCREEN |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
418 /* this code replaces X11_FULLSCREEN hack in mplayer.c |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
419 * aspect() is available through aspect.h for all vos. |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
420 * besides zooming should only be done with -zoom, |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
421 * but I leave the old -fs behaviour so users don't get |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
422 * irritated for now (and send lots o' mails ;) ::atmos |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
423 */ |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
424 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
425 aspect(&d_width,&d_height,A_ZOOM); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
426 #endif |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
427 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
428 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
429 vo_dwidth=d_width; vo_dheight=d_height; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
430 hint.flags = PPosition | PSize /* | PBaseSize */; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
431 hint.base_width = hint.width; hint.base_height = hint.height; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
432 XGetWindowAttributes(mDisplay, DefaultRootWindow(mDisplay), &attribs); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
433 depth=attribs.depth; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
434 if (depth != 15 && depth != 16 && depth != 24 && depth != 32) depth = 24; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
435 XMatchVisualInfo(mDisplay, mScreen, depth, TrueColor, &vinfo); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
436 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
437 xswa.background_pixel = 0; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
438 if (keycolor_handling == 1) |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
439 xswa.background_pixel = keycolor;// 2110; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
440 xswa.border_pixel = 0; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
441 xswamask = CWBackPixel | CWBorderPixel; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
442 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
443 if ( WinID>=0 ){ |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
444 vo_window = WinID ? ((Window)WinID) : mRootWin; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
445 if ( WinID ) |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
446 { |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
447 XUnmapWindow( mDisplay,vo_window ); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
448 XChangeWindowAttributes( mDisplay,vo_window,xswamask,&xswa ); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
449 vo_x11_selectinput_witherr( mDisplay,vo_window,StructureNotifyMask | KeyPressMask | PropertyChangeMask | PointerMotionMask | ButtonPressMask | ButtonReleaseMask | ExposureMask ); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
450 XMapWindow( mDisplay,vo_window ); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
451 } else { drwX=vo_dx; drwY=vo_dy; } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
452 } else |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
453 if ( vo_window == None ){ |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
454 vo_window = XCreateWindow(mDisplay, mRootWin, |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
455 hint.x, hint.y, hint.width, hint.height, |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
456 0, depth,CopyFromParent,vinfo.visual,xswamask,&xswa); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
457 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
458 vo_x11_classhint( mDisplay,vo_window,"xvmc" ); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
459 vo_hidecursor(mDisplay,vo_window); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
460 |
10497
9e6becbd5c8a
draw rectangle with color key, avoid blue bars. avoid PutSurface before 1'st image
iive
parents:
10452
diff
changeset
|
461 vo_x11_selectinput_witherr(mDisplay, vo_window, StructureNotifyMask | KeyPressMask | PropertyChangeMask | ExposureMask | |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
462 ((WinID==0) ? 0 : (PointerMotionMask |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
463 | ButtonPressMask | ButtonReleaseMask)) ); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
464 XSetStandardProperties(mDisplay, vo_window, hello, hello, None, NULL, 0, &hint); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
465 XSetWMNormalHints( mDisplay,vo_window,&hint ); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
466 XMapWindow(mDisplay, vo_window); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
467 if ( flags&1 ) vo_x11_fullscreen(); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
468 else { |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
469 #ifdef HAVE_XINERAMA |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
470 vo_x11_xinerama_move(mDisplay,vo_window); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
471 #endif |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
472 vo_x11_sizehint( hint.x, hint.y, hint.width, hint.height,0 ); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
473 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
474 } else { |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
475 // vo_fs set means we were already at fullscreen |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
476 vo_x11_sizehint( hint.x, hint.y, hint.width, hint.height,0 ); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
477 if ( !vo_fs ) XMoveResizeWindow( mDisplay,vo_window,hint.x,hint.y,hint.width,hint.height ); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
478 if ( flags&1 && !vo_fs ) vo_x11_fullscreen(); // handle -fs on non-first file |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
479 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
480 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
481 // vo_x11_sizehint( hint.x, hint.y, hint.width, hint.height,0 ); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
482 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
483 if ( vo_gc != None ) XFreeGC( mDisplay,vo_gc ); |
10452 | 484 vo_gc = XCreateGC(mDisplay, vo_window, GCForeground, &xgcv); |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
485 XFlush(mDisplay); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
486 XSync(mDisplay, False); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
487 #ifdef HAVE_XF86VM |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
488 if ( vm ) |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
489 { |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
490 /* Grab the mouse pointer in our window */ |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
491 if(vo_grabpointer) |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
492 XGrabPointer(mDisplay, vo_window, True, 0, |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
493 GrabModeAsync, GrabModeAsync, |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
494 vo_window, None, CurrentTime ); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
495 XSetInputFocus(mDisplay, vo_window, RevertToNone, CurrentTime); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
496 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
497 #endif |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
498 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
499 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
500 aspect(&vo_dwidth,&vo_dheight,A_NOZOOM); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
501 if ( (( flags&1 )&&( WinID <= 0 )) || vo_fs ) |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
502 { |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
503 aspect(&vo_dwidth,&vo_dheight,A_ZOOM); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
504 drwX=( vo_screenwidth - (vo_dwidth > vo_screenwidth?vo_screenwidth:vo_dwidth) ) / 2; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
505 drwY=( vo_screenheight - (vo_dheight > vo_screenheight?vo_screenheight:vo_dheight) ) / 2; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
506 vo_dwidth=(vo_dwidth > vo_screenwidth?vo_screenwidth:vo_dwidth); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
507 vo_dheight=(vo_dheight > vo_screenheight?vo_screenheight:vo_dheight); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
508 mp_msg(MSGT_VO,MSGL_V, "[xvmc-fs] dx: %d dy: %d dw: %d dh: %d\n",drwX,drwY,vo_dwidth,vo_dheight ); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
509 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
510 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
511 panscan_calc(); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
512 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
513 mp_msg(MSGT_VO,MSGL_V, "[xvmc] dx: %d dy: %d dw: %d dh: %d\n",drwX,drwY,vo_dwidth,vo_dheight ); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
514 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
515 saver_off(mDisplay); // turning off screen saver |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
516 //end vo_xv |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
517 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
518 /* store image dimesions for displaying */ |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
519 p_render_surface_visible = NULL; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
520 p_render_surface_to_show = NULL; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
521 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
522 vo_directrendering = 1;//ugly hack, coz xvmc works only with direct rendering |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
523 return 0; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
524 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
525 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
526 static uint32_t draw_frame(uint8_t *srcp[]){ |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
527 assert(0 && srcp==NULL);//silense unused srcp warning |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
528 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
529 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
530 static void draw_osd(void){ |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
531 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
532 |
10452 | 533 static void xvmc_sync_surface(XvMCSurface * srf){ |
534 int status,rez; | |
535 rez = XvMCGetSurfaceStatus(mDisplay,srf,&status); | |
536 assert(rez==Success); | |
537 if( status & XVMC_RENDERING ) | |
538 XvMCSyncSurface(mDisplay, srf); | |
539 /* | |
540 rez = XvMCFlushSurface(mDisplay, srf); | |
541 assert(rez==Success); | |
542 | |
543 do { | |
544 usleep(1); | |
545 printf("waiting...\n"); | |
546 XvMCGetSurfaceStatus(mDisplay,srf,&status); | |
547 } while (status & XVMC_RENDERING); | |
548 */ | |
549 } | |
550 | |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
551 static void flip_page(void){ |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
552 int rez; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
553 int clipX,clipY,clipW,clipH; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
554 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
555 clipX = drwX-(vo_panscan_x>>1); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
556 clipY = drwY-(vo_panscan_y>>1); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
557 clipW = vo_dwidth+vo_panscan_x; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
558 clipH = vo_dheight+vo_panscan_y;// |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
559 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
560 if( verbose > 3 ) |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
561 printf("vo_xvmc: flip_page show(rndr=%p)\n\n",p_render_surface_to_show); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
562 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
563 if(p_render_surface_to_show == NULL) return; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
564 assert( p_render_surface_to_show->magic == MP_XVMC_RENDER_MAGIC ); |
10452 | 565 //fixme assert( p_render_surface_to_show != p_render_surface_visible); |
566 | |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
567 // make sure the rendering is done |
10452 | 568 xvmc_sync_surface(p_render_surface_to_show->p_surface); |
569 | |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
570 //the visible surface won't be displayed anymore, mark it as free |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
571 if( p_render_surface_visible!=NULL ) |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
572 p_render_surface_visible->state &= ~MP_XVMC_STATE_DISPLAY_PENDING; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
573 |
10452 | 574 //!!fixme assert(p_render_surface_to_show->state & MP_XVMC_STATE_DISPLAY_PENDING); |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
575 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
576 // show it |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
577 // if(benchmark) |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
578 rez=XvMCPutSurface(mDisplay, p_render_surface_to_show->p_surface, vo_window, |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
579 0, 0, image_width, image_height, |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
580 clipX, clipY, clipW, clipH, |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
581 3);//p_render_surface_to_show->display_flags); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
582 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
583 assert(rez==Success); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
584 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
585 p_render_surface_visible = p_render_surface_to_show; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
586 p_render_surface_to_show = NULL; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
587 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
588 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
589 static void check_events(void){ |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
590 int dwidth,dheight; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
591 Window mRoot; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
592 uint32_t drwBorderWidth,drwDepth; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
593 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
594 int e=vo_x11_check_events(mDisplay); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
595 if(e&VO_EVENT_RESIZE) |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
596 { |
10497
9e6becbd5c8a
draw rectangle with color key, avoid blue bars. avoid PutSurface before 1'st image
iive
parents:
10452
diff
changeset
|
597 e |= VO_EVENT_EXPOSE; |
9e6becbd5c8a
draw rectangle with color key, avoid blue bars. avoid PutSurface before 1'st image
iive
parents:
10452
diff
changeset
|
598 |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
599 XGetGeometry( mDisplay,vo_window,&mRoot,&drwX,&drwY,&vo_dwidth,&vo_dheight, |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
600 &drwBorderWidth,&drwDepth ); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
601 drwX = drwY = 0; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
602 mp_msg(MSGT_VO,MSGL_V, "[xvmc] dx: %d dy: %d dw: %d dh: %d\n",drwX,drwY, |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
603 vo_dwidth,vo_dheight ); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
604 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
605 aspect(&dwidth,&dheight,A_NOZOOM); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
606 if ( vo_fs ) |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
607 { |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
608 aspect(&dwidth,&dheight,A_ZOOM); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
609 drwX=( vo_screenwidth - (dwidth > vo_screenwidth?vo_screenwidth:dwidth) ) / 2; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
610 drwY=( vo_screenheight - (dheight > vo_screenheight?vo_screenheight:dheight) ) / 2; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
611 vo_dwidth=(dwidth > vo_screenwidth?vo_screenwidth:dwidth); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
612 vo_dheight=(dheight > vo_screenheight?vo_screenheight:dheight); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
613 mp_msg(MSGT_VO,MSGL_V, "[xvmc-fs] dx: %d dy: %d dw: %d dh: %d\n",drwX,drwY,vo_dwidth,vo_dheight ); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
614 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
615 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
616 if ( e & VO_EVENT_EXPOSE ) |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
617 { |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
618 mDrawColorKey(drwX,drwY,vo_dwidth,vo_dheight); |
10497
9e6becbd5c8a
draw rectangle with color key, avoid blue bars. avoid PutSurface before 1'st image
iive
parents:
10452
diff
changeset
|
619 if(p_render_surface_visible != NULL) |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
620 XvMCPutSurface(mDisplay, p_render_surface_visible->p_surface,vo_window, |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
621 0, 0, image_width, image_height, |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
622 drwX,drwY,vo_dwidth,vo_dheight, |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
623 3);//,p_render_surface_visible->display_flags);!! |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
624 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
625 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
626 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
627 static void xvmc_free(void){ |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
628 int i; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
629 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
630 if( number_of_surfaces ){ |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
631 XvMCDestroyMacroBlocks(mDisplay,&mv_blocks); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
632 XvMCDestroyBlocks(mDisplay,&data_blocks); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
633 for(i=0; i<number_of_surfaces; i++) |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
634 { |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
635 XvMCHideSurface(mDisplay,&surface_array[i]);//it doesn't hurt, I hope |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
636 XvMCDestroySurface(mDisplay,&surface_array[i]); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
637 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
638 if( (surface_render[i].state != 0) && |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
639 (p_render_surface_visible != &surface_render[i]) ) |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
640 printf("vo_xvmc::uninit surface_render[%d].status=%d\n",i, |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
641 surface_render[i].state); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
642 } |
10452 | 643 |
644 free(surface_render);surface_render=NULL; | |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
645 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
646 XvMCDestroyContext(mDisplay,&ctx); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
647 if( verbose > 3) printf("vo_xvmc: Context sucessfuly freed\n"); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
648 number_of_surfaces = 0; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
649 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
650 if( xv_port !=0 ){ |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
651 XvUngrabPort(mDisplay,xv_port,CurrentTime); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
652 xv_port = 0; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
653 if( verbose > 3) printf("vo_xvmc: xv_port sucessfuly ungrabed\n"); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
654 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
655 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
656 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
657 static void uninit(void){ |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
658 if( verbose > 3 ) printf("vo_xvmc: uninit called\n"); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
659 xvmc_free(); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
660 //from vo_xv |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
661 saver_on(mDisplay); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
662 vo_vm_close(mDisplay); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
663 vo_x11_uninit(); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
664 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
665 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
666 static uint32_t query_format(uint32_t format){ |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
667 uint32_t flags; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
668 XvMCSurfaceInfo qsurface_info; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
669 int mode_id; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
670 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
671 if(verbose > 3) |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
672 printf("vo_xvmc: query_format=%X\n",format); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
673 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
674 if(!IMGFMT_IS_XVMC(format)) return 0;// no caps supported |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
675 mode_id = xvmc_find_surface_by_format(format, 16, 16, &qsurface_info, 1);//true=1 - quering |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
676 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
677 if( mode_id == 0 ) return 0; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
678 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
679 flags = VFCAP_CSP_SUPPORTED | |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
680 VFCAP_CSP_SUPPORTED_BY_HW | |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
681 VFCAP_ACCEPT_STRIDE; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
682 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
683 // if(surfce_info.subpicture) |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
684 // flags|=VFCAP_OSD; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
685 return flags; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
686 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
687 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
688 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
689 static uint32_t draw_slice(uint8_t *image[], int stride[], |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
690 int w, int h, int x, int y){ |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
691 xvmc_render_state_t * rndr; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
692 int rez; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
693 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
694 if(verbose > 3) |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
695 printf("vo_xvmc: draw_slice y=%d\n",y); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
696 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
697 rndr = (xvmc_render_state_t*)image[2];//this is copy of priv-ate |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
698 assert( rndr != NULL ); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
699 assert( rndr->magic == MP_XVMC_RENDER_MAGIC ); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
700 |
10499 | 701 if(rndr->p_past_surface != NULL) |
702 xvmc_sync_surface(rndr->p_past_surface); | |
703 if(rndr->p_future_surface != NULL) | |
704 xvmc_sync_surface(rndr->p_future_surface); | |
705 | |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
706 rez = XvMCRenderSurface(mDisplay,&ctx,rndr->picture_structure, |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
707 rndr->p_surface, |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
708 rndr->p_past_surface, |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
709 rndr->p_future_surface, |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
710 rndr->flags, |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
711 rndr->filled_mv_blocks_num,rndr->start_mv_blocks_num, |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
712 &mv_blocks,&data_blocks); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
713 #if 1 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
714 if(rez!=Success) |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
715 { |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
716 int i; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
717 printf("vo_xvmc::slice: RenderSirface returned %d\n",rez); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
718 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
719 printf("vo_xvmc::slice: pict=%d,flags=%x,start_blocks=%d,num_blocks=%d\n", |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
720 rndr->picture_structure,rndr->flags,rndr->start_mv_blocks_num, |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
721 rndr->filled_mv_blocks_num); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
722 printf("vo_xvmc::slice: this_surf=%p, past_surf=%p, future_surf=%p\n", |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
723 rndr->p_surface,rndr->p_past_surface,rndr->p_future_surface); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
724 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
725 for(i=0;i<rndr->filled_mv_blocks_num;i++){ |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
726 XvMCMacroBlock* testblock; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
727 testblock=&mv_blocks.macro_blocks[i]; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
728 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
729 printf("vo_xvmc::slice: mv_block - x=%d,y=%d,mb_type=0x%x,mv_type=0x%x,mv_field_select=%d\n", |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
730 testblock->x,testblock->y,testblock->macroblock_type, |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
731 testblock->motion_type,testblock->motion_vertical_field_select); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
732 printf("vo_xvmc::slice: dct_type=%d,data_index=0x%x,cbp=%d,pad0=%d\n", |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
733 testblock->dct_type,testblock->index,testblock->coded_block_pattern, |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
734 testblock->pad0); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
735 printf("vo_xvmc::slice: PMV[0][0][0/1]=(%d,%d)\n", |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
736 testblock->PMV[0][0][0],testblock->PMV[0][0][1]); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
737 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
738 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
739 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
740 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
741 #endif |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
742 assert(rez==Success); |
10452 | 743 if(verbose > 3 ) printf("vo_xvmc: flush surface\n"); |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
744 rez = XvMCFlushSurface(mDisplay, rndr->p_surface); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
745 assert(rez==Success); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
746 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
747 // rndr->start_mv_blocks_num += rndr->filled_mv_blocks_num; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
748 rndr->start_mv_blocks_num = 0; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
749 rndr->filled_mv_blocks_num = 0; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
750 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
751 rndr->next_free_data_block_num = 0; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
752 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
753 return VO_TRUE; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
754 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
755 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
756 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
757 static inline int find_free_surface(){ |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
758 int i,j,t; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
759 int stat; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
760 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
761 j=-1; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
762 for(i=0; i<number_of_surfaces; i++){ |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
763 // printf("vo_xvmc: surface[%d].state=%d ( surf=%p)\n",i, |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
764 // surface_render[i].state, surface_render[i].p_surface); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
765 if( surface_render[i].state == 0){ |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
766 XvMCGetSurfaceStatus(mDisplay, surface_render[i].p_surface,&stat); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
767 if( (stat & XVMC_DISPLAYING) == 0 ) return i; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
768 j=i; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
769 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
770 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
771 if(j>=0){//all surfaces are busy, but there is one that will be free |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
772 //on next monitor retrace, we just have to wait |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
773 for(t=0;t<1000;t++){ |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
774 // usleep(10); //!!! |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
775 printf("vo_xvmc: waiting retrace\n"); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
776 XvMCGetSurfaceStatus(mDisplay, surface_render[j].p_surface,&stat); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
777 if( (stat & XVMC_DISPLAYING) == 0 ) return j; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
778 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
779 assert(0);//10 seconds wait for surface to get free! |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
780 exit(1); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
781 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
782 return -1; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
783 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
784 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
785 static uint32_t get_image(mp_image_t *mpi){ |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
786 int getsrf; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
787 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
788 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
789 getsrf=find_free_surface(); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
790 if(getsrf<0){ |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
791 int i; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
792 printf("vo_xvmc: no free surfaces, this should not happen in g1\n"); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
793 for(i=0;i<number_of_surfaces;i++) |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
794 printf("vo_xvmc: surface[%d].state=%d\n",i,surface_render[i].state); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
795 return VO_FALSE; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
796 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
797 |
10452 | 798 assert(surface_render[getsrf].start_mv_blocks_num == 0); |
799 assert(surface_render[getsrf].filled_mv_blocks_num == 0); | |
800 assert(surface_render[getsrf].next_free_data_block_num == 0); | |
801 | |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
802 mpi->flags |= MP_IMGFLAG_DIRECT; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
803 //keep strides 0 to avoid field manipulations |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
804 mpi->stride[0] = 0; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
805 mpi->stride[1] = 0; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
806 mpi->stride[2] = 0; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
807 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
808 // these are shared!! so watch out |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
809 // do call RenderSurface before overwriting |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
810 mpi->planes[0] = (char*)data_blocks.blocks; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
811 mpi->planes[1] = (char*)mv_blocks.macro_blocks; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
812 mpi->priv = |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
813 mpi->planes[2] = (char*)&surface_render[getsrf]; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
814 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
815 surface_render[getsrf].picture_structure = 0; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
816 surface_render[getsrf].flags = 0; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
817 surface_render[getsrf].state = 0; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
818 surface_render[getsrf].start_mv_blocks_num = 0; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
819 surface_render[getsrf].filled_mv_blocks_num = 0; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
820 surface_render[getsrf].next_free_data_block_num = 0; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
821 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
822 if( verbose > 3 ) |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
823 printf("vo_xvmc: get_image: .rndr=%p surface[%d]=%p \n", |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
824 mpi->priv,getsrf,surface_render[getsrf].p_surface); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
825 return VO_TRUE; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
826 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
827 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
828 static uint32_t control(uint32_t request, void *data, ... ) |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
829 { |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
830 switch (request){ |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
831 case VOCTRL_QUERY_FORMAT: |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
832 return query_format(*((uint32_t*)data)); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
833 case VOCTRL_DRAW_IMAGE: |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
834 return xvmc_draw_image((mp_image_t *)data); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
835 case VOCTRL_GET_IMAGE: |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
836 return get_image((mp_image_t *)data); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
837 //vo_xv |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
838 case VOCTRL_GUISUPPORT: |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
839 return VO_TRUE; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
840 case VOCTRL_FULLSCREEN: |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
841 vo_x11_fullscreen(); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
842 case VOCTRL_GET_PANSCAN: |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
843 if ( !vo_config_count || !vo_fs ) return VO_FALSE; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
844 return VO_TRUE; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
845 // indended, fallthrough to update panscan on fullscreen/windowed switch |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
846 case VOCTRL_SET_PANSCAN: |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
847 if ( ( vo_fs && ( vo_panscan != vo_panscan_amount ) ) || ( !vo_fs && vo_panscan_amount ) ) |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
848 { |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
849 int old_y = vo_panscan_y; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
850 panscan_calc(); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
851 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
852 if(old_y != vo_panscan_y) |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
853 { |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
854 XClearWindow(mDisplay, vo_window); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
855 XFlush(mDisplay); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
856 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
857 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
858 return VO_TRUE; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
859 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
860 case VOCTRL_SET_EQUALIZER: |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
861 { |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
862 va_list ap; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
863 int value; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
864 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
865 va_start(ap, data); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
866 value = va_arg(ap, int); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
867 va_end(ap); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
868 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
869 return(vo_xv_set_eq(xv_port, data, value)); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
870 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
871 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
872 case VOCTRL_GET_EQUALIZER: |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
873 { |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
874 va_list ap; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
875 int *value; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
876 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
877 va_start(ap, data); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
878 value = va_arg(ap, int*); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
879 va_end(ap); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
880 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
881 return(vo_xv_get_eq(xv_port, data, value)); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
882 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
883 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
884 return VO_NOTIMPL; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
885 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
886 |