Mercurial > mplayer.hg
annotate libvo/vo_xvmc.c @ 28281:234831aa5256
Treat mlib as a normal FFmpeg option, not a CPU extension.
author | diego |
---|---|
date | Thu, 15 Jan 2009 15:51:50 +0000 |
parents | 87ca91cfba34 |
children | 7681eab10aea |
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> |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
4 #include <unistd.h> |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
5 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
6 #include "config.h" |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
7 #include "mp_msg.h" |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
8 #include "video_out.h" |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
9 #include "video_out_internal.h" |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
10 #include "osdep/timer.h" |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
11 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
12 #include <X11/Xlib.h> |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
13 #include <X11/Xutil.h> |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
14 #include <X11/Xatom.h> |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
15 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
16 #ifdef HAVE_SHM |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
17 #include <sys/ipc.h> |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
18 #include <sys/shm.h> |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
19 #include <X11/extensions/XShm.h> |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
20 #endif |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
21 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
22 #include <X11/extensions/Xv.h> |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
23 #include <X11/extensions/Xvlib.h> |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
24 #include <X11/extensions/XvMClib.h> |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
25 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
26 #include "x11_common.h" |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
27 #include "xvmc_render.h" |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
28 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
29 #include "sub.h" |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
30 #include "aspect.h" |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
31 |
14742 | 32 #include "subopt-helper.h" |
33 | |
27343 | 34 #ifdef CONFIG_GUI |
23077 | 35 #include "gui/interface.h" |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
36 #endif |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
37 |
22461
c54ad95f852a
Factor out some duplicated code in vo_xv and vo_xvmc
reimar
parents:
22257
diff
changeset
|
38 #include "libavutil/common.h" |
c54ad95f852a
Factor out some duplicated code in vo_xv and vo_xvmc
reimar
parents:
22257
diff
changeset
|
39 |
24595 | 40 //no chance for xinerama to be supported in the near future |
27377
d58d06eafe83
Change a bunch of X11-specific preprocessor directives.
diego
parents:
27343
diff
changeset
|
41 #undef CONFIG_XINERAMA |
10360
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 #undef NDEBUG |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
44 #include <assert.h> |
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 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
47 #define UNUSED(x) ((void)(x)) |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
48 |
22813 | 49 #include "libavcodec/avcodec.h" |
50 #if LIBAVCODEC_BUILD < ((51<<16)+(40<<8)+2) | |
51 #error You need at least libavcodecs v51.40.2 | |
52 #endif | |
53 | |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
54 |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
55 static int benchmark; |
14742 | 56 static int use_sleep; |
15102
1d3ba9fb75cd
incorporate all image drawing in single function and use fixed vo_xv_draw_colorkey() for proper key drawing.
iive
parents:
15060
diff
changeset
|
57 static int first_frame;//draw colorkey on first frame |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
58 static int use_queue; |
14742 | 59 static int xv_port_request = 0; |
26730
41794a5fb100
Add a new suboption to -vo xv and -vo xvmc that allows selection
ben
parents:
25220
diff
changeset
|
60 static int xv_adaptor = -1; |
20244 | 61 static int bob_deinterlace; |
62 static int top_field_first; | |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
63 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
64 static int image_width,image_height; |
22257
f979aa12d8cc
Don't free and then allocate surfaces when config() is called again with same resolution and format.
iive
parents:
22246
diff
changeset
|
65 static int image_format; |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
66 static uint32_t drwX,drwY; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
67 |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
68 #define NO_SUBPICTURE 0 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
69 #define OVERLAY_SUBPICTURE 1 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
70 #define BLEND_SUBPICTURE 2 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
71 #define BACKEND_SUBPICTURE 3 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
72 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
73 static int subpicture_mode; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
74 static int subpicture_alloc; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
75 static XvMCSubpicture subpicture; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
76 static XvImageFormatValues subpicture_info; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
77 static int subpicture_clear_color;//transparent color for the subpicture or color key for overlay |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
78 |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
79 static XvMCSurfaceInfo surface_info; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
80 static XvMCContext ctx; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
81 static XvMCBlockArray data_blocks; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
82 static XvMCMacroBlockArray mv_blocks; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
83 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
84 #define MAX_SURFACES 8 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
85 static int number_of_surfaces=0; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
86 static XvMCSurface surface_array[MAX_SURFACES]; |
28202 | 87 static struct xvmc_render_state * surface_render; |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
88 |
28202 | 89 static struct xvmc_render_state * p_render_surface_to_show=NULL; |
90 static struct xvmc_render_state * p_render_surface_visible=NULL; | |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
91 |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
92 //display queue, kinda render ahead |
28202 | 93 static struct xvmc_render_state * show_queue[MAX_SURFACES]; |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
94 static int free_element; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
95 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
96 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
97 static void (*draw_osd_fnc)(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
98 static void (*clear_osd_fnc)(int x0,int y0, int w,int h); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
99 static void (*init_osd_fnc)(void); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
100 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
101 static void draw_osd_AI44(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
102 static void draw_osd_IA44(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
103 static void clear_osd_subpic(int x0,int y0, int w,int h); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
104 static void init_osd_yuv_pal(void); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
105 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
106 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
107 static const struct{ |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
108 int id;//id as xvimages or as mplayer RGB|{8,15,16,24,32} |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
109 void (* init_func_ptr)(); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
110 void (* draw_func_ptr)(); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
111 void (* clear_func_ptr)(); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
112 } osd_render[]={ |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
113 {0x34344149,init_osd_yuv_pal,draw_osd_AI44,clear_osd_subpic}, |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
114 {0x34344941,init_osd_yuv_pal,draw_osd_IA44,clear_osd_subpic}, |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
115 {0,NULL,NULL,NULL} |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
116 }; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
117 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
118 static void xvmc_free(void); |
22257
f979aa12d8cc
Don't free and then allocate surfaces when config() is called again with same resolution and format.
iive
parents:
22246
diff
changeset
|
119 static void xvmc_clean_surfaces(void); |
28232
8df85ad26746
Add missing 'void' keyword to parameterless function declarations.
diego
parents:
28202
diff
changeset
|
120 static int count_free_surfaces(void); |
8df85ad26746
Add missing 'void' keyword to parameterless function declarations.
diego
parents:
28202
diff
changeset
|
121 static struct xvmc_render_state * find_free_surface(void); |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
122 |
25216 | 123 static const vo_info_t info = { |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
124 "XVideo Motion Compensation", |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
125 "xvmc", |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
126 "Ivan Kalvachev <iive@users.sf.net>", |
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 |
25220
c9e9ac2008c2
Mark the vo_functions_t definitions as const where possible.
reimar
parents:
25216
diff
changeset
|
130 const LIBVO_EXTERN(xvmc); |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
131 |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
132 //shm stuff from vo_xv |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
133 #ifdef HAVE_SHM |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
134 static XShmSegmentInfo Shminfo; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
135 static int Shmem_Flag; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
136 #endif |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
137 XvImage * xvimage; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
138 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
139 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
140 static void allocate_xvimage(int xvimage_width,int xvimage_height,int xv_format) |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
141 { |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
142 /* |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
143 * allocate XvImages. FIXME: no error checking, without |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
144 * mit-shm this will bomb... trzing to fix ::atmos |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
145 */ |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
146 #ifdef HAVE_SHM |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
147 if ( mLocalDisplay && XShmQueryExtension( mDisplay ) ) Shmem_Flag = 1; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
148 else |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
149 { |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
150 Shmem_Flag = 0; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
151 mp_msg(MSGT_VO,MSGL_INFO, "Shared memory not supported\nReverting to normal Xv\n" ); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
152 } |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
153 if ( Shmem_Flag ) |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
154 { |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
155 xvimage = (XvImage *) XvShmCreateImage(mDisplay, xv_port, xv_format, |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
156 NULL, xvimage_width, xvimage_height, &Shminfo); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
157 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
158 Shminfo.shmid = shmget(IPC_PRIVATE, xvimage->data_size, IPC_CREAT | 0777); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
159 Shminfo.shmaddr = (char *) shmat(Shminfo.shmid, 0, 0); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
160 Shminfo.readOnly = False; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
161 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
162 xvimage->data = Shminfo.shmaddr; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
163 XShmAttach(mDisplay, &Shminfo); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
164 XSync(mDisplay, False); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
165 shmctl(Shminfo.shmid, IPC_RMID, 0); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
166 } |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
167 else |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
168 #endif |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
169 { |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
170 xvimage = (XvImage *) XvCreateImage(mDisplay, xv_port, xv_format, NULL, xvimage_width, xvimage_height); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
171 xvimage->data = malloc(xvimage->data_size); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
172 XSync(mDisplay,False); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
173 } |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
174 // memset(xvimage->data,128,xvimage->data_size); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
175 return; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
176 } |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
177 |
28232
8df85ad26746
Add missing 'void' keyword to parameterless function declarations.
diego
parents:
28202
diff
changeset
|
178 static void deallocate_xvimage(void) |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
179 { |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
180 #ifdef HAVE_SHM |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
181 if ( Shmem_Flag ) |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
182 { |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
183 XShmDetach( mDisplay,&Shminfo ); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
184 shmdt( Shminfo.shmaddr ); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
185 } |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
186 else |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
187 #endif |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
188 { |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
189 free(xvimage->data); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
190 } |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
191 XFree(xvimage); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
192 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
193 XSync(mDisplay, False); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
194 return; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
195 } |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
196 //end of vo_xv shm/xvimage code |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
197 |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
198 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
|
199 if ( format == IMGFMT_XVMC_IDCT_MPEG2 ){ |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
200 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
|
201 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
|
202 return 0; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
203 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
204 if ( format == IMGFMT_XVMC_MOCO_MPEG2 ){ |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
205 if(surf_info->mc_type != XVMC_MPEG_2) return -1; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
206 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
|
207 return 0; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
208 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
209 return -1;//fail |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
210 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
211 |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
212 //print all info needed to add new format |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
213 static void print_xvimage_format_values(XvImageFormatValues *xifv){ |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
214 int i; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
215 printf("Format_ID = 0x%X\n",xifv->id); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
216 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
217 printf(" type = "); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
218 if(xifv->type == XvRGB) printf("RGB\n"); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
219 else if(xifv->type == XvYUV) printf("YUV\n"); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
220 else printf("Unknown\n"); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
221 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
222 printf(" byte_order = "); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
223 if(xifv->byte_order == LSBFirst) printf("LSB First\n"); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
224 else if(xifv->type == MSBFirst) printf("MSB First\n"); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
225 else printf("Unknown\n");//yes Linux support other types too |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
226 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
227 printf(" guid = "); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
228 for(i=0;i<16;i++) |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
229 printf("%02X ",(unsigned char)xifv->guid[i]); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
230 printf("\n"); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
231 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
232 printf(" bits_per_pixel = %d\n",xifv->bits_per_pixel); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
233 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
234 printf(" format = "); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
235 if(xifv->format == XvPacked) printf("XvPacked\n"); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
236 else if(xifv->format == XvPlanar) printf("XvPlanar\n"); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
237 else printf("Unknown\n"); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
238 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
239 printf(" num_planes = %d\n",xifv->num_planes); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
240 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
241 if(xifv->type == XvRGB){ |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
242 printf(" red_mask = %0X\n", xifv->red_mask); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
243 printf(" green_mask = %0X\n",xifv->green_mask); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
244 printf(" blue_mask = %0X\n", xifv->blue_mask); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
245 } |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
246 if(xifv->type == XvYUV){ |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
247 printf(" y_sample_bits = %d\n u_sample_bits = %d\n v_sample_bits = %d\n", |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
248 xifv->y_sample_bits,xifv->u_sample_bits,xifv->v_sample_bits); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
249 printf(" horz_y_period = %d\n horz_u_period = %d\n horz_v_period = %d\n", |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
250 xifv->horz_y_period,xifv->horz_u_period,xifv->horz_v_period); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
251 printf(" vert_y_period = %d\n vert_u_period = %d\n vert_v_period = %d\n", |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
252 xifv->vert_y_period,xifv->vert_u_period,xifv->vert_v_period); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
253 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
254 printf(" component_order = "); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
255 for(i=0;i<32;i++) |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
256 if(xifv->component_order[i]>=32) |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
257 printf("%c",xifv->component_order[i]); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
258 printf("\n"); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
259 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
260 printf(" scanline = "); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
261 if(xifv->scanline_order == XvTopToBottom) printf("XvTopToBottom\n"); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
262 else if(xifv->scanline_order == XvBottomToTop) printf("XvBottomToTop\n"); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
263 else printf("Unknown\n"); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
264 } |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
265 printf("\n"); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
266 } |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
267 |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
268 // WARNING This function may changes xv_port and surface_info! |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
269 static int xvmc_find_surface_by_format(int format,int width,int height, |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
270 XvMCSurfaceInfo * surf_info,int query){ |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
271 int rez; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
272 XvAdaptorInfo * ai; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
273 int num_adaptors,i; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
274 unsigned long p; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
275 int s,mc_surf_num; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
276 XvMCSurfaceInfo * mc_surf_list; |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
277 |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
278 rez = XvQueryAdaptors(mDisplay,DefaultRootWindow(mDisplay),&num_adaptors,&ai); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
279 if( rez != Success ) return -1; |
17932 | 280 if( mp_msg_test(MSGT_VO,MSGL_DBG3) ) { |
281 printf("vo_xvmc: Querying %d adaptors\n",num_adaptors); } | |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
282 for(i=0; i<num_adaptors; i++) |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
283 { |
26730
41794a5fb100
Add a new suboption to -vo xv and -vo xvmc that allows selection
ben
parents:
25220
diff
changeset
|
284 /* check if adaptor number has been specified */ |
41794a5fb100
Add a new suboption to -vo xv and -vo xvmc that allows selection
ben
parents:
25220
diff
changeset
|
285 if (xv_adaptor != -1 && xv_adaptor != i) |
41794a5fb100
Add a new suboption to -vo xv and -vo xvmc that allows selection
ben
parents:
25220
diff
changeset
|
286 continue; |
17932 | 287 if( mp_msg_test(MSGT_VO,MSGL_DBG3) ) { |
288 printf("vo_xvmc: Quering adaptor #%d\n",i); } | |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
289 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
|
290 //probing ports |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
291 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
|
292 { |
17932 | 293 if( mp_msg_test(MSGT_VO,MSGL_DBG3) ) { |
294 printf("vo_xvmc: probing port #%ld\n",p); } | |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
295 mc_surf_list = XvMCListSurfaceTypes(mDisplay,p,&mc_surf_num); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
296 if( mc_surf_list == NULL || mc_surf_num == 0){ |
17932 | 297 if( mp_msg_test(MSGT_VO,MSGL_DBG3) ) { |
298 printf("vo_xvmc: No XvMC supported. \n"); } | |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
299 continue; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
300 } |
17932 | 301 if( mp_msg_test(MSGT_VO,MSGL_DBG3) ) { |
302 printf("vo_xvmc: XvMC list have %d surfaces\n",mc_surf_num); } | |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
303 //we have XvMC list! |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
304 for(s=0; s<mc_surf_num; s++) |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
305 { |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
306 if( width > mc_surf_list[s].max_width ) continue; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
307 if( height > mc_surf_list[s].max_height ) continue; |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
308 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
|
309 //we have match! |
14742 | 310 /* respect the users wish */ |
311 if ( xv_port_request != 0 && xv_port_request != p ) | |
312 { | |
313 continue; | |
314 } | |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
315 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
316 if(!query){ |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
317 rez = XvGrabPort(mDisplay,p,CurrentTime); |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
318 if(rez != Success){ |
17932 | 319 if ( mp_msg_test(MSGT_VO,MSGL_DBG3) ) { |
320 printf("vo_xvmc: Fail to grab port %ld\n",p); } | |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
321 continue; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
322 } |
26730
41794a5fb100
Add a new suboption to -vo xv and -vo xvmc that allows selection
ben
parents:
25220
diff
changeset
|
323 printf("vo_xvmc: Using Xv Adaptor #%d (%s)\n", i, ai[i].name); |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
324 printf("vo_xvmc: Port %ld grabed\n",p); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
325 xv_port = p; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
326 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
327 goto surface_found; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
328 }//for mc surf |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
329 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
|
330 }//for ports |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
331 }//for adaptors |
22203 | 332 XvFreeAdaptorInfo(ai); |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
333 |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
334 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
|
335 return 0; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
336 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
337 // somebody know cleaner way to escape from 3 internal loops? |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
338 surface_found: |
22203 | 339 XvFreeAdaptorInfo(ai); |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
340 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
341 memcpy(surf_info,&mc_surf_list[s],sizeof(XvMCSurfaceInfo)); |
17932 | 342 if( mp_msg_test(MSGT_VO,MSGL_DBG3) || !query) |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
343 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
|
344 mc_surf_list[s].surface_type_id,p,i); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
345 return mc_surf_list[s].surface_type_id; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
346 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
347 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
348 static uint32_t xvmc_draw_image(mp_image_t *mpi){ |
28202 | 349 struct xvmc_render_state * rndr; |
10360
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 assert(mpi!=NULL); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
352 assert(mpi->flags &MP_IMGFLAG_DIRECT); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
353 // assert(mpi->flags &MP_IMGFLAGS_DRAWBACK); |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
354 |
28202 | 355 rndr = (struct xvmc_render_state*)mpi->priv;//there is copy in plane[2] |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
356 assert( rndr != NULL ); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
357 assert( rndr->magic == MP_XVMC_RENDER_MAGIC ); |
17932 | 358 if( mp_msg_test(MSGT_VO,MSGL_DBG4) ) |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
359 printf("vo_xvmc: draw_image(show rndr=%p)\n",rndr); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
360 // 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
|
361 rndr->state |= MP_XVMC_STATE_DISPLAY_PENDING; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
362 p_render_surface_to_show = rndr; |
20244 | 363 top_field_first = mpi->fields & MP_IMGFIELD_TOP_FIRST; |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
364 return VO_TRUE; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
365 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
366 |
16171
fd51fd1ff231
Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents:
15866
diff
changeset
|
367 static int preinit(const char *arg){ |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
368 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
|
369 int mc_eventBase,mc_errorBase; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
370 int mc_ver,mc_rev; |
14742 | 371 strarg_t ck_src_arg = { 0, NULL }; |
372 strarg_t ck_method_arg = { 0, NULL }; | |
373 opt_t subopts [] = | |
374 { | |
375 /* name arg type arg var test */ | |
376 { "port", OPT_ARG_INT, &xv_port_request, (opt_test_f)int_pos }, | |
26730
41794a5fb100
Add a new suboption to -vo xv and -vo xvmc that allows selection
ben
parents:
25220
diff
changeset
|
377 { "adaptor", OPT_ARG_INT, &xv_adaptor, (opt_test_f)int_non_neg }, |
14742 | 378 { "ck", OPT_ARG_STR, &ck_src_arg, xv_test_ck }, |
379 { "ck-method", OPT_ARG_STR, &ck_method_arg, xv_test_ckm }, | |
380 { "benchmark", OPT_ARG_BOOL, &benchmark, NULL }, | |
381 { "sleep", OPT_ARG_BOOL, &use_sleep, NULL }, | |
382 { "queue", OPT_ARG_BOOL, &use_queue, NULL }, | |
20244 | 383 { "bobdeint", OPT_ARG_BOOL, &bob_deinterlace, NULL }, |
14742 | 384 { NULL } |
385 }; | |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
386 |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
387 //Obtain display handler |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
388 if (!vo_init()) return -1;//vo_xv |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
389 |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
390 //XvMC is subdivision of XVideo |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
391 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
|
392 &xv_event_base,&xv_error_base) ){ |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
393 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
|
394 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
|
395 return -1; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
396 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
397 printf("vo_xvmc: X-Video extension %d.%d\n",xv_version,xv_release); |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
398 |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
399 if( True != XvMCQueryExtension(mDisplay,&mc_eventBase,&mc_errorBase) ){ |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
400 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
|
401 XDisplayName(NULL)); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
402 return -1; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
403 } |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
404 |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
405 if(Success == XvMCQueryVersion(mDisplay, &mc_ver, &mc_rev) ){ |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
406 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
|
407 mc_ver,mc_rev); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
408 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
409 else{ |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
410 printf("vo_xvmc: Error querying version info!\n"); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
411 return -1; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
412 } |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
413 surface_render = NULL; |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
414 xv_port = 0; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
415 number_of_surfaces = 0; |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
416 subpicture_alloc = 0; |
10452 | 417 |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
418 benchmark = 0; //disable PutImageto allow faster display than screen refresh |
14742 | 419 use_sleep = 0; |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
420 use_queue = 0; |
20244 | 421 bob_deinterlace = 0; |
14742 | 422 |
423 /* parse suboptions */ | |
424 if ( subopt_parse( arg, subopts ) != 0 ) | |
425 { | |
426 return -1; | |
427 } | |
428 | |
429 xv_setup_colorkeyhandling( ck_method_arg.str, ck_src_arg.str ); | |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
430 |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
431 return 0; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
432 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
433 |
22246 | 434 static int config(uint32_t width, uint32_t height, |
435 uint32_t d_width, uint32_t d_height, | |
436 uint32_t flags, char *title, uint32_t format){ | |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
437 int i,mode_id,rez; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
438 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
|
439 |
22246 | 440 //from vo_xv |
441 XVisualInfo vinfo; | |
442 XSetWindowAttributes xswa; | |
443 XWindowAttributes attribs; | |
444 unsigned long xswamask; | |
445 int depth; | |
27377
d58d06eafe83
Change a bunch of X11-specific preprocessor directives.
diego
parents:
27343
diff
changeset
|
446 #ifdef CONFIG_XF86VM |
27952
94bab93a8d17
Simplify handling of VOFLAG_MODESWITCHNG, merge assignment and declaration
reimar
parents:
27946
diff
changeset
|
447 int vm = flags & VOFLAG_MODESWITCHING; |
22246 | 448 #endif |
449 //end of vo_xv | |
450 | |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
451 if( !IMGFMT_IS_XVMC(format) ) |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
452 { |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
453 assert(0);//should never happen, abort on debug or |
22246 | 454 return 1;//return error on relese |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
455 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
456 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
457 // Find free port that supports MC, by querying adaptors |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
458 if( xv_port != 0 || number_of_surfaces != 0 ){ |
22257
f979aa12d8cc
Don't free and then allocate surfaces when config() is called again with same resolution and format.
iive
parents:
22246
diff
changeset
|
459 if( height==image_height && width==image_width && image_format==format){ |
f979aa12d8cc
Don't free and then allocate surfaces when config() is called again with same resolution and format.
iive
parents:
22246
diff
changeset
|
460 xvmc_clean_surfaces(); |
f979aa12d8cc
Don't free and then allocate surfaces when config() is called again with same resolution and format.
iive
parents:
22246
diff
changeset
|
461 goto skip_surface_allocation; |
f979aa12d8cc
Don't free and then allocate surfaces when config() is called again with same resolution and format.
iive
parents:
22246
diff
changeset
|
462 } |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
463 xvmc_free(); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
464 }; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
465 numblocks=((width+15)/16)*((height+15)/16); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
466 // Find Supported Surface Type |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
467 mode_id = xvmc_find_surface_by_format(format,width,height,&surface_info,0);//false=1 to grab port, not query |
14742 | 468 if ( mode_id == 0 ) |
469 { | |
470 return -1; | |
471 } | |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
472 |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
473 rez = XvMCCreateContext(mDisplay, xv_port,mode_id,width,height,XVMC_DIRECT,&ctx); |
17228 | 474 if( rez != Success ){ |
475 printf("vo_xvmc: XvMCCreateContext failed with error %d\n",rez); | |
476 return -1; | |
477 } | |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
478 if( ctx.flags & XVMC_DIRECT ){ |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
479 printf("vo_xvmc: Allocated Direct Context\n"); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
480 }else{ |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
481 printf("vo_xvmc: Allocated Indirect Context!\n"); |
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 |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
484 |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
485 blocks_per_macroblock = 6; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
486 if(surface_info.chroma_format == XVMC_CHROMA_FORMAT_422) |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
487 blocks_per_macroblock = 8; |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
488 if(surface_info.chroma_format == XVMC_CHROMA_FORMAT_444) |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
489 blocks_per_macroblock = 12; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
490 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
491 rez = XvMCCreateBlocks(mDisplay,&ctx,numblocks*blocks_per_macroblock,&data_blocks); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
492 if( rez != Success ){ |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
493 XvMCDestroyContext(mDisplay,&ctx); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
494 return -1; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
495 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
496 printf("vo_xvmc: data_blocks allocated\n"); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
497 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
498 rez = XvMCCreateMacroBlocks(mDisplay,&ctx,numblocks,&mv_blocks); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
499 if( rez != Success ){ |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
500 XvMCDestroyBlocks(mDisplay,&data_blocks); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
501 XvMCDestroyContext(mDisplay,&ctx); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
502 return -1; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
503 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
504 printf("vo_xvmc: mv_blocks allocated\n"); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
505 |
10452 | 506 if(surface_render==NULL) |
28202 | 507 surface_render=malloc(MAX_SURFACES*sizeof(struct xvmc_render_state));//easy mem debug |
508 memset(surface_render,0,MAX_SURFACES*sizeof(struct xvmc_render_state)); | |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
509 |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
510 for(i=0; i<MAX_SURFACES; i++){ |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
511 rez=XvMCCreateSurface(mDisplay,&ctx,&surface_array[i]); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
512 if( rez != Success ) |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
513 break; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
514 surface_render[i].magic = MP_XVMC_RENDER_MAGIC; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
515 surface_render[i].data_blocks = data_blocks.blocks; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
516 surface_render[i].mv_blocks = mv_blocks.macro_blocks; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
517 surface_render[i].total_number_of_mv_blocks = numblocks; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
518 surface_render[i].total_number_of_data_blocks = numblocks*blocks_per_macroblock;; |
10452 | 519 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
|
520 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
|
521 surface_render[i].chroma_format = surface_info.chroma_format; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
522 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
|
523 surface_render[i].p_surface = &surface_array[i]; |
17932 | 524 if( mp_msg_test(MSGT_VO,MSGL_DBG4) ) |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
525 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
|
526 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
527 number_of_surfaces = i; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
528 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
|
529 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
|
530 uninit(); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
531 return -1; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
532 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
533 printf("vo_xvmc: Motion Compensation context allocated - %d surfaces\n", |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
534 number_of_surfaces); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
535 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
536 //debug |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
537 printf("vo_xvmc: idct=%d unsigned_intra=%d\n", |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
538 (surface_info.mc_type & XVMC_IDCT) == XVMC_IDCT, |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
539 (surface_info.flags & XVMC_INTRA_UNSIGNED) == XVMC_INTRA_UNSIGNED); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
540 |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
541 // Find way to display OSD & subtitle |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
542 printf("vo_xvmc: looking for OSD support\n"); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
543 subpicture_mode = NO_SUBPICTURE; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
544 if(surface_info.flags & XVMC_OVERLAID_SURFACE) |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
545 subpicture_mode = OVERLAY_SUBPICTURE; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
546 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
547 if(surface_info.subpicture_max_width != 0 && |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
548 surface_info.subpicture_max_height != 0 ){ |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
549 int s,k,num_subpic; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
550 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
551 XvImageFormatValues * xvfmv; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
552 xvfmv = XvMCListSubpictureTypes(mDisplay, xv_port, |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
553 surface_info.surface_type_id, &num_subpic); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
554 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
555 if(num_subpic != 0 && xvfmv != NULL){ |
17932 | 556 if( mp_msg_test(MSGT_VO,MSGL_DBG4) ){//Print all subpicture types for debug |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
557 for(s=0;s<num_subpic;s++) |
11415 | 558 print_xvimage_format_values(&xvfmv[s]); |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
559 } |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
560 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
561 for(s=0;s<num_subpic;s++){ |
10714 | 562 for(k=0;osd_render[k].draw_func_ptr!=NULL;k++){ |
563 if(xvfmv[s].id == osd_render[k].id) | |
564 { | |
565 init_osd_fnc = osd_render[k].init_func_ptr; | |
566 draw_osd_fnc = osd_render[k].draw_func_ptr; | |
567 clear_osd_fnc = osd_render[k].clear_func_ptr; | |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
568 |
10714 | 569 subpicture_mode = BLEND_SUBPICTURE; |
570 subpicture_info = xvfmv[s]; | |
11415 | 571 printf(" Subpicture id 0x%08X\n",subpicture_info.id); |
10714 | 572 goto found_subpic; |
573 } | |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
574 } |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
575 } |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
576 found_subpic: |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
577 XFree(xvfmv); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
578 } |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
579 //Blend2 supicture is always possible, blend1 only at backend |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
580 if( (subpicture_mode == BLEND_SUBPICTURE) && |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
581 (surface_info.flags & XVMC_BACKEND_SUBPICTURE) ) |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
582 { |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
583 subpicture_mode = BACKEND_SUBPICTURE; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
584 } |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
585 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
586 } |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
587 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
588 switch(subpicture_mode){ |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
589 case NO_SUBPICTURE: |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
590 printf("vo_xvmc: No OSD support for this mode\n"); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
591 break; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
592 case OVERLAY_SUBPICTURE: |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
593 printf("vo_xvmc: OSD support via color key tricks\n"); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
594 printf("vo_xvmc: not yet implemented:(\n"); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
595 break; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
596 case BLEND_SUBPICTURE: |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
597 printf("vo_xvmc: OSD support by additional frontend rendering\n"); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
598 break; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
599 case BACKEND_SUBPICTURE: |
22129 | 600 printf("vo_xvmc: OSD support by backend rendering (fast)\n"); |
22135 | 601 printf("vo_xvmc: Please send feedback to confirm that it works,otherwise send bugreport!\n"); |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
602 break; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
603 } |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
604 |
14742 | 605 //take keycolor value and choose method for handling it |
606 if ( !vo_xv_init_colorkey() ) | |
607 { | |
608 return -1; // bail out, colorkey setup failed | |
609 } | |
610 | |
15866 | 611 vo_xv_enable_vsync();//it won't break anything |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
612 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
613 //taken from vo_xv |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
614 image_height = height; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
615 image_width = width; |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
616 |
22257
f979aa12d8cc
Don't free and then allocate surfaces when config() is called again with same resolution and format.
iive
parents:
22246
diff
changeset
|
617 skip_surface_allocation: |
f979aa12d8cc
Don't free and then allocate surfaces when config() is called again with same resolution and format.
iive
parents:
22246
diff
changeset
|
618 |
27343 | 619 #ifdef CONFIG_GUI |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
620 if(use_gui) |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
621 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
|
622 else |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
623 #endif |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
624 { |
27377
d58d06eafe83
Change a bunch of X11-specific preprocessor directives.
diego
parents:
27343
diff
changeset
|
625 #ifdef CONFIG_XF86VM |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
626 if ( vm ) |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
627 { |
27890
a4e2700e9381
Simplify vo_vm_switch and vo_vm_close, everyone was using the (almost) same
reimar
parents:
27412
diff
changeset
|
628 vo_vm_switch(); |
10360
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 else |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
631 #endif |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
632 XGetWindowAttributes(mDisplay, DefaultRootWindow(mDisplay), &attribs); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
633 depth=attribs.depth; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
634 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
|
635 XMatchVisualInfo(mDisplay, mScreen, depth, TrueColor, &vinfo); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
636 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
637 xswa.background_pixel = 0; |
14742 | 638 if (xv_ck_info.method == CK_METHOD_BACKGROUND) |
639 xswa.background_pixel = xv_colorkey; | |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
640 xswa.border_pixel = 0; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
641 xswamask = CWBackPixel | CWBorderPixel; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
642 |
23655
00aa61cde84a
Make X11 window creation and (with -fixed-vo) management simpler and more
reimar
parents:
23376
diff
changeset
|
643 vo_x11_create_vo_window(&vinfo, vo_dx, vo_dy, d_width, d_height, flags, |
00aa61cde84a
Make X11 window creation and (with -fixed-vo) management simpler and more
reimar
parents:
23376
diff
changeset
|
644 CopyFromParent, "xvmc", title); |
00aa61cde84a
Make X11 window creation and (with -fixed-vo) management simpler and more
reimar
parents:
23376
diff
changeset
|
645 XChangeWindowAttributes(mDisplay, vo_window, xswamask, &xswa); |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
646 |
27377
d58d06eafe83
Change a bunch of X11-specific preprocessor directives.
diego
parents:
27343
diff
changeset
|
647 #ifdef CONFIG_XF86VM |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
648 if ( vm ) |
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 /* Grab the mouse pointer in our window */ |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
651 if(vo_grabpointer) |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
652 XGrabPointer(mDisplay, vo_window, True, 0, |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
653 GrabModeAsync, GrabModeAsync, |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
654 vo_window, None, CurrentTime ); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
655 XSetInputFocus(mDisplay, vo_window, RevertToNone, CurrentTime); |
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 #endif |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
658 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
659 |
22461
c54ad95f852a
Factor out some duplicated code in vo_xv and vo_xvmc
reimar
parents:
22257
diff
changeset
|
660 if ((flags & VOFLAG_FULLSCREEN) && WinID <= 0) vo_fs = 1; |
28250 | 661 vo_calc_drwXY(&drwX, &drwY); |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
662 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
663 panscan_calc(); |
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 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
|
666 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
667 //end vo_xv |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
668 |
22246 | 669 /* store image dimesions for displaying */ |
670 p_render_surface_visible = NULL; | |
671 p_render_surface_to_show = NULL; | |
672 | |
673 free_element = 0; | |
674 first_frame = 1; | |
675 | |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
676 vo_directrendering = 1;//ugly hack, coz xvmc works only with direct rendering |
22257
f979aa12d8cc
Don't free and then allocate surfaces when config() is called again with same resolution and format.
iive
parents:
22246
diff
changeset
|
677 image_format=format; |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
678 return 0; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
679 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
680 |
16171
fd51fd1ff231
Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents:
15866
diff
changeset
|
681 static int draw_frame(uint8_t *srcp[]){ |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
682 UNUSED(srcp); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
683 assert(0); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
684 } |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
685 |
28232
8df85ad26746
Add missing 'void' keyword to parameterless function declarations.
diego
parents:
28202
diff
changeset
|
686 static void init_osd_yuv_pal(void) { |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
687 char * palette; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
688 int rez; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
689 int i,j; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
690 int snum,seb; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
691 int Y,U,V; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
692 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
693 subpicture_clear_color = 0; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
694 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
695 if(subpicture.num_palette_entries > 0){ |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
696 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
697 snum = subpicture.num_palette_entries; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
698 seb = subpicture.entry_bytes; |
18878 | 699 palette = malloc(snum*seb);//check fail |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
700 if(palette == NULL) return; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
701 for(i=0; i<snum; i++){ |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
702 // 0-black max-white the other are gradients |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
703 Y = i*(1 << subpicture_info.y_sample_bits)/snum;//snum=2;->(0),(1*(1<<1)/2) |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
704 U = 1 << (subpicture_info.u_sample_bits - 1); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
705 V = 1 << (subpicture_info.v_sample_bits - 1); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
706 for(j=0; j<seb; j++) |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
707 switch(subpicture.component_order[j]){ |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
708 case 'U': palette[i*seb+j] = U; break; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
709 case 'V': palette[i*seb+j] = V; break; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
710 case 'Y': |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
711 default: |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
712 palette[i*seb+j] = Y; break; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
713 } |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
714 } |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
715 rez = XvMCSetSubpicturePalette(mDisplay, &subpicture, palette); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
716 if(rez!=Success){ |
21874 | 717 printf("vo_xvmc: Setting palette failed.\n"); |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
718 } |
22203 | 719 free(palette); |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
720 } |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
721 } |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
722 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
723 static void clear_osd_subpic(int x0, int y0, int w, int h){ |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
724 int rez; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
725 rez=XvMCClearSubpicture(mDisplay, &subpicture, |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
726 x0, y0, w,h, |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
727 subpicture_clear_color); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
728 if(rez != Success) |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
729 printf("vo_xvmc: XvMCClearSubpicture failed!\n"); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
730 } |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
731 |
28232
8df85ad26746
Add missing 'void' keyword to parameterless function declarations.
diego
parents:
28202
diff
changeset
|
732 static void OSD_init(void) { |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
733 unsigned short osd_height, osd_width; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
734 int rez; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
735 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
736 if(subpicture_alloc){ |
17932 | 737 if( mp_msg_test(MSGT_VO,MSGL_DBG4) ) |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
738 printf("vo_xvmc: destroying subpicture\n"); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
739 XvMCDestroySubpicture(mDisplay,&subpicture); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
740 deallocate_xvimage(); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
741 subpicture_alloc = 0; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
742 } |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
743 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
744 /* if(surface_info.flags & XVMC_SUBPICTURE_INDEPENDENT_SCALING){ |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
745 osd_width = vo_dwidth; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
746 osd_height = vo_dheight; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
747 }else*/ |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
748 { |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
749 osd_width = image_width; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
750 osd_height = image_height; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
751 } |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
752 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
753 if(osd_width > surface_info.subpicture_max_width) |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
754 osd_width = surface_info.subpicture_max_width; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
755 if(osd_height > surface_info.subpicture_max_height) |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
756 osd_height = surface_info.subpicture_max_height; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
757 if(osd_width == 0 || osd_height == 0) |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
758 return;//if called before window size is known |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
759 |
17932 | 760 if( mp_msg_test(MSGT_VO,MSGL_DBG4) ) |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
761 printf("vo_xvmc: creating subpicture (%d,%d) format %X\n", |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
762 osd_width,osd_height,subpicture_info.id); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
763 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
764 rez = XvMCCreateSubpicture(mDisplay,&ctx,&subpicture, |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
765 osd_width,osd_height,subpicture_info.id); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
766 if(rez != Success){ |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
767 subpicture_mode = NO_SUBPICTURE; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
768 printf("vo_xvmc: Create Subpicture failed, OSD disabled\n"); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
769 return; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
770 } |
17932 | 771 if( mp_msg_test(MSGT_VO,MSGL_DBG4) ){ |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
772 int i; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
773 printf("vo_xvmc: Created Subpicture:\n"); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
774 printf(" xvimage_id=0x%X\n",subpicture.xvimage_id); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
775 printf(" width=%d\n",subpicture.width); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
776 printf(" height=%d\n",subpicture.height); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
777 printf(" num_palette_entries=0x%X\n",subpicture.num_palette_entries); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
778 printf(" entry_bytes=0x%X\n",subpicture.entry_bytes); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
779 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
780 printf(" component_order=\""); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
781 for(i=0; i<4; i++) |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
782 if(subpicture.component_order[i] >= 32) |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
783 printf("%c", subpicture.component_order[i]); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
784 printf("\"\n"); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
785 } |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
786 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
787 //call init for the surface type |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
788 init_osd_fnc();//init palete,clear color etc ... |
17932 | 789 if( mp_msg_test(MSGT_VO,MSGL_DBG4) ) |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
790 printf("vo_xvmc: clearing subpicture\n"); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
791 clear_osd_fnc(0, 0, subpicture.width, subpicture.height); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
792 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
793 allocate_xvimage(subpicture.width, subpicture.height, subpicture_info.id); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
794 subpicture_alloc = 1; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
795 } |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
796 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
797 static void draw_osd_IA44(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride){ |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
798 int ox,oy; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
799 int rez; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
800 |
17932 | 801 if( mp_msg_test(MSGT_VO,MSGL_DBG4) ) |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
802 printf("vo_xvmc:composite AI44 subpicture (%d,%d - %d,%d)\n",x0,y0,w,h); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
803 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
804 for(ox=0; ox<w; ox++){ |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
805 for(oy=0; oy<h; oy++){ |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
806 xvimage->data[oy*xvimage->width+ox] = (src[oy*stride+ox]>>4) | ((0-srca[oy*stride+ox])&0xf0); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
807 } |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
808 } |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
809 rez = XvMCCompositeSubpicture(mDisplay, &subpicture, xvimage, 0, 0, |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
810 w,h,x0,y0); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
811 if(rez != Success){ |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
812 printf("vo_xvmc: composite subpicture failed\n"); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
813 assert(0); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
814 } |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
815 } |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
816 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
817 static void draw_osd_AI44(int x0,int y0, int w,int h, unsigned char* src, unsigned char *srca, int stride){ |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
818 int ox,oy; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
819 int rez; |
17932 | 820 if( mp_msg_test(MSGT_VO,MSGL_DBG4) ) |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
821 printf("vo_xvmc:composite AI44 subpicture (%d,%d - %d,%d)\n",x0,y0,w,h); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
822 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
823 for(ox=0; ox<w; ox++){ |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
824 for(oy=0; oy<h; oy++){ |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
825 xvimage->data[oy*xvimage->width+ox] = (src[oy*stride+ox]&0xf0) | (((0-srca[oy*stride+ox])>>4)&0xf); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
826 } |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
827 } |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
828 rez = XvMCCompositeSubpicture(mDisplay, &subpicture, xvimage, 0, 0, |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
829 w,h,x0,y0); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
830 if(rez != Success){ |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
831 printf("vo_xvmc: composite subpicture failed\n"); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
832 assert(0); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
833 } |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
834 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
835 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
836 static void draw_osd(void){ |
28202 | 837 struct xvmc_render_state * osd_rndr; |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
838 int osd_has_changed; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
839 int have_osd_to_draw; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
840 int rez; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
841 |
17932 | 842 if( mp_msg_test(MSGT_VO,MSGL_DBG4) ) |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
843 printf("vo_xvmc: draw_osd ,OSD_mode=%d, surface_to_show=%p\n", |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
844 subpicture_mode,p_render_surface_to_show); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
845 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
846 if(subpicture_mode == BLEND_SUBPICTURE || |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
847 subpicture_mode == BACKEND_SUBPICTURE ){ |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
848 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
849 if(!subpicture_alloc) //allocate subpicture when dimensions are known |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
850 OSD_init(); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
851 if(!subpicture_alloc) |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
852 return;//dimensions still unknown. |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
853 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
854 osd_has_changed = vo_update_osd(subpicture.width, subpicture.height); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
855 have_osd_to_draw = vo_osd_check_range_update(0, 0, subpicture.width, |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
856 subpicture.height); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
857 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
858 if(!have_osd_to_draw) |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
859 return;//nothing to draw,no subpic, no blend |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
860 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
861 if(osd_has_changed){ |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
862 //vo_remove_text(subpicture.width, subpicture.height,clear_osd_fnc) |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
863 clear_osd_fnc(0,0,subpicture.width,subpicture.height); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
864 vo_draw_text(subpicture.width, subpicture.height, draw_osd_fnc); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
865 } |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
866 XvMCSyncSubpicture(mDisplay,&subpicture);//todo usleeep wait! |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
867 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
868 if(subpicture_mode == BLEND_SUBPICTURE){ |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
869 osd_rndr = find_free_surface(); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
870 if(osd_rndr == NULL) |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
871 return;// no free surface to draw OSD in |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
872 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
873 rez = XvMCBlendSubpicture2(mDisplay, |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
874 p_render_surface_to_show->p_surface, osd_rndr->p_surface, |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
875 &subpicture, |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
876 0, 0, subpicture.width, subpicture.height, |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
877 0, 0, image_width, image_height); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
878 if(rez!=Success){ |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
879 printf("vo_xvmc: BlendSubpicture failed rez=%d\n",rez); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
880 assert(0); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
881 return; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
882 } |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
883 // XvMCFlushSurface(mDisplay,osd_rndr->p_surface);//fixme- should I? |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
884 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
885 //When replaceing the surface with osd one, save the flags too! |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
886 osd_rndr->picture_structure = p_render_surface_to_show->picture_structure; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
887 osd_rndr->display_flags = p_render_surface_to_show->display_flags; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
888 //add more if needed osd_rndr-> = p_render_surface_to_show->; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
889 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
890 p_render_surface_to_show->state &= ~MP_XVMC_STATE_DISPLAY_PENDING; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
891 p_render_surface_to_show->state |= MP_XVMC_STATE_OSD_SOURCE; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
892 p_render_surface_to_show->p_osd_target_surface_render = osd_rndr; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
893 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
894 p_render_surface_to_show = osd_rndr; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
895 p_render_surface_to_show->state = MP_XVMC_STATE_DISPLAY_PENDING; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
896 |
17932 | 897 if( mp_msg_test(MSGT_VO,MSGL_DBG4) ) |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
898 printf("vo_xvmc:draw_osd: surface_to_show changed to %p\n",osd_rndr); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
899 }//endof if(BLEND) |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
900 if(subpicture_mode == BACKEND_SUBPICTURE){ |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
901 rez = XvMCBlendSubpicture(mDisplay, |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
902 p_render_surface_to_show->p_surface, |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
903 &subpicture, |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
904 0, 0, subpicture.width, subpicture.height, |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
905 0, 0, image_width, image_height); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
906 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
907 } |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
908 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
909 }//if(BLEND||BACKEND) |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
910 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
911 |
10452 | 912 static void xvmc_sync_surface(XvMCSurface * srf){ |
913 int status,rez; | |
914 rez = XvMCGetSurfaceStatus(mDisplay,srf,&status); | |
915 assert(rez==Success); | |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
916 if((status & XVMC_RENDERING) == 0) |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
917 return;//surface is already complete |
14742 | 918 if(use_sleep){ |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
919 rez = XvMCFlushSurface(mDisplay, srf); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
920 assert(rez==Success); |
10452 | 921 |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
922 do{ |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
923 usec_sleep(1000);//1ms (may be 20ms on linux) |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
924 XvMCGetSurfaceStatus(mDisplay,srf,&status); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
925 } while (status & XVMC_RENDERING); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
926 return;//done |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
927 } |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
928 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
929 XvMCSyncSurface(mDisplay, srf); |
10452 | 930 } |
931 | |
28202 | 932 static void put_xvmc_image(struct xvmc_render_state * p_render_surface, |
933 int draw_ck){ | |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
934 int rez; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
935 int clipX,clipY,clipW,clipH; |
20244 | 936 int i; |
15060 | 937 |
938 if(p_render_surface == NULL) | |
939 return; | |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
940 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
941 clipX = drwX-(vo_panscan_x>>1); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
942 clipY = drwY-(vo_panscan_y>>1); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
943 clipW = vo_dwidth+vo_panscan_x; |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
944 clipH = vo_dheight+vo_panscan_y; |
15102
1d3ba9fb75cd
incorporate all image drawing in single function and use fixed vo_xv_draw_colorkey() for proper key drawing.
iive
parents:
15060
diff
changeset
|
945 |
1d3ba9fb75cd
incorporate all image drawing in single function and use fixed vo_xv_draw_colorkey() for proper key drawing.
iive
parents:
15060
diff
changeset
|
946 if(draw_ck) |
1d3ba9fb75cd
incorporate all image drawing in single function and use fixed vo_xv_draw_colorkey() for proper key drawing.
iive
parents:
15060
diff
changeset
|
947 vo_xv_draw_colorkey(clipX,clipY,clipW,clipH); |
1d3ba9fb75cd
incorporate all image drawing in single function and use fixed vo_xv_draw_colorkey() for proper key drawing.
iive
parents:
15060
diff
changeset
|
948 |
1d3ba9fb75cd
incorporate all image drawing in single function and use fixed vo_xv_draw_colorkey() for proper key drawing.
iive
parents:
15060
diff
changeset
|
949 if(benchmark) |
1d3ba9fb75cd
incorporate all image drawing in single function and use fixed vo_xv_draw_colorkey() for proper key drawing.
iive
parents:
15060
diff
changeset
|
950 return; |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
951 |
20244 | 952 for (i = 1; i <= bob_deinterlace + 1; i++) { |
953 int field = top_field_first ? i : i ^ 3; | |
15060 | 954 rez = XvMCPutSurface(mDisplay, p_render_surface->p_surface, |
955 vo_window, | |
956 0, 0, image_width, image_height, | |
957 clipX, clipY, clipW, clipH, | |
20244 | 958 bob_deinterlace ? field : 3); |
959 //p_render_surface_to_show->display_flags); | |
15060 | 960 if(rez != Success){ |
15102
1d3ba9fb75cd
incorporate all image drawing in single function and use fixed vo_xv_draw_colorkey() for proper key drawing.
iive
parents:
15060
diff
changeset
|
961 printf("vo_xvmc: PutSurface failer, critical error %d!\n",rez); |
15060 | 962 assert(0); |
963 } | |
20244 | 964 } |
15102
1d3ba9fb75cd
incorporate all image drawing in single function and use fixed vo_xv_draw_colorkey() for proper key drawing.
iive
parents:
15060
diff
changeset
|
965 XFlush(mDisplay); |
15060 | 966 } |
967 | |
968 static void flip_page(void){ | |
969 int i,cfs; | |
970 | |
971 | |
17932 | 972 if( mp_msg_test(MSGT_VO,MSGL_DBG4) ) |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
973 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
|
974 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
975 if(p_render_surface_to_show == NULL) return; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
976 assert( p_render_surface_to_show->magic == MP_XVMC_RENDER_MAGIC ); |
10452 | 977 //fixme assert( p_render_surface_to_show != p_render_surface_visible); |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
978 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
979 if(use_queue){ |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
980 // fill the queue until only n free surfaces remain |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
981 // after that start displaying |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
982 cfs = count_free_surfaces(); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
983 show_queue[free_element++] = p_render_surface_to_show; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
984 if(cfs > 3){//well have 3 free surfaces after add queue |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
985 if(free_element > 1)//a little voodoo magic |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
986 xvmc_sync_surface(show_queue[0]->p_surface); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
987 return; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
988 } |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
989 p_render_surface_to_show=show_queue[0]; |
17932 | 990 if( mp_msg_test(MSGT_VO,MSGL_DBG5) ) |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
991 printf("vo_xvmc: flip_queue free_element=%d\n",free_element); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
992 free_element--; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
993 for(i=0; i<free_element; i++){ |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
994 show_queue[i] = show_queue[i+1]; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
995 } |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
996 show_queue[free_element] = NULL; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
997 } |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
998 |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
999 // make sure the rendering is done |
10452 | 1000 xvmc_sync_surface(p_render_surface_to_show->p_surface); |
1001 | |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1002 //the visible surface won't be displayed anymore, mark it as free |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1003 if(p_render_surface_visible != NULL) |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1004 p_render_surface_visible->state &= ~MP_XVMC_STATE_DISPLAY_PENDING; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1005 |
10452 | 1006 //!!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
|
1007 |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1008 //show it, displaying is always vsynced, so skip it for benchmark |
15102
1d3ba9fb75cd
incorporate all image drawing in single function and use fixed vo_xv_draw_colorkey() for proper key drawing.
iive
parents:
15060
diff
changeset
|
1009 put_xvmc_image(p_render_surface_to_show,first_frame); |
1d3ba9fb75cd
incorporate all image drawing in single function and use fixed vo_xv_draw_colorkey() for proper key drawing.
iive
parents:
15060
diff
changeset
|
1010 first_frame=0;//make sure we won't draw it anymore |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1011 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1012 p_render_surface_visible = p_render_surface_to_show; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1013 p_render_surface_to_show = NULL; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1014 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1015 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1016 static void check_events(void){ |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1017 int e=vo_x11_check_events(mDisplay); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1018 if(e&VO_EVENT_RESIZE) |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1019 { |
10497
9e6becbd5c8a
draw rectangle with color key, avoid blue bars. avoid PutSurface before 1'st image
iive
parents:
10452
diff
changeset
|
1020 e |= VO_EVENT_EXPOSE; |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1021 |
28251
87ca91cfba34
Fix build: calc_drwXY was factorized into vo_calc_drwXY.
diego
parents:
28250
diff
changeset
|
1022 vo_calc_drwXY(&drwX, &drwY); |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1023 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1024 if ( e & VO_EVENT_EXPOSE ) |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1025 { |
15102
1d3ba9fb75cd
incorporate all image drawing in single function and use fixed vo_xv_draw_colorkey() for proper key drawing.
iive
parents:
15060
diff
changeset
|
1026 put_xvmc_image(p_render_surface_visible,1); |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1027 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1028 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1029 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1030 static void xvmc_free(void){ |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1031 int i; |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1032 if( subpicture_alloc ){ |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1033 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1034 XvMCDestroySubpicture(mDisplay,&subpicture); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1035 deallocate_xvimage(); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1036 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1037 subpicture_alloc = 0; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1038 |
17932 | 1039 if( mp_msg_test(MSGT_VO,MSGL_DBG4) ) |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1040 printf("vo_xvmc: subpicture destroyed\n"); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1041 } |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1042 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1043 if( number_of_surfaces ){ |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1044 |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1045 XvMCDestroyMacroBlocks(mDisplay,&mv_blocks); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1046 XvMCDestroyBlocks(mDisplay,&data_blocks); |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1047 |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1048 for(i=0; i<number_of_surfaces; i++) |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1049 { |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1050 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
|
1051 XvMCDestroySurface(mDisplay,&surface_array[i]); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1052 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1053 if( (surface_render[i].state != 0) && |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1054 (p_render_surface_visible != &surface_render[i]) ) |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1055 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
|
1056 surface_render[i].state); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1057 } |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1058 |
28202 | 1059 memset(surface_render,0,MAX_SURFACES*sizeof(struct xvmc_render_state));//for debuging |
10452 | 1060 free(surface_render);surface_render=NULL; |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1061 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1062 XvMCDestroyContext(mDisplay,&ctx); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1063 number_of_surfaces = 0; |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1064 |
17932 | 1065 if( mp_msg_test(MSGT_VO,MSGL_DBG4) ) { |
1066 printf("vo_xvmc: Context sucessfuly freed\n"); } | |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1067 } |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1068 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1069 |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1070 if( xv_port !=0 ){ |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1071 XvUngrabPort(mDisplay,xv_port,CurrentTime); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1072 xv_port = 0; |
17932 | 1073 if( mp_msg_test(MSGT_VO,MSGL_DBG4) ) { |
1074 printf("vo_xvmc: xv_port sucessfuly ungrabed\n"); } | |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1075 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1076 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1077 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1078 static void uninit(void){ |
17932 | 1079 if( mp_msg_test(MSGT_VO,MSGL_DBG4) ) { |
1080 printf("vo_xvmc: uninit called\n"); } | |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1081 xvmc_free(); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1082 //from vo_xv |
27377
d58d06eafe83
Change a bunch of X11-specific preprocessor directives.
diego
parents:
27343
diff
changeset
|
1083 #ifdef CONFIG_XF86VM |
27890
a4e2700e9381
Simplify vo_vm_switch and vo_vm_close, everyone was using the (almost) same
reimar
parents:
27412
diff
changeset
|
1084 vo_vm_close(); |
15211 | 1085 #endif |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1086 vo_x11_uninit(); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1087 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1088 |
16171
fd51fd1ff231
Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents:
15866
diff
changeset
|
1089 static int query_format(uint32_t format){ |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1090 uint32_t flags; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1091 XvMCSurfaceInfo qsurface_info; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1092 int mode_id; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1093 |
17932 | 1094 if( mp_msg_test(MSGT_VO,MSGL_DBG4) ) |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1095 printf("vo_xvmc: query_format=%X\n",format); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1096 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1097 if(!IMGFMT_IS_XVMC(format)) return 0;// no caps supported |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1098 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
|
1099 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1100 if( mode_id == 0 ) return 0; |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1101 |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1102 flags = VFCAP_CSP_SUPPORTED | |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1103 VFCAP_CSP_SUPPORTED_BY_HW | |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1104 VFCAP_ACCEPT_STRIDE; |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1105 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1106 if( (qsurface_info.subpicture_max_width != 0) && |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1107 (qsurface_info.subpicture_max_height != 0) ) |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1108 flags|=VFCAP_OSD; |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1109 return flags; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1110 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1111 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1112 |
16171
fd51fd1ff231
Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents:
15866
diff
changeset
|
1113 static int draw_slice(uint8_t *image[], int stride[], |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1114 int w, int h, int x, int y){ |
28202 | 1115 struct xvmc_render_state * rndr; |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1116 int rez; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1117 |
17932 | 1118 if( mp_msg_test(MSGT_VO,MSGL_DBG4) ) |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1119 printf("vo_xvmc: draw_slice y=%d\n",y); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1120 |
28202 | 1121 rndr = (struct xvmc_render_state*)image[2];//this is copy of priv-ate |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1122 assert( rndr != NULL ); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1123 assert( rndr->magic == MP_XVMC_RENDER_MAGIC ); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1124 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1125 rez = XvMCRenderSurface(mDisplay,&ctx,rndr->picture_structure, |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1126 rndr->p_surface, |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1127 rndr->p_past_surface, |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1128 rndr->p_future_surface, |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1129 rndr->flags, |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1130 rndr->filled_mv_blocks_num,rndr->start_mv_blocks_num, |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1131 &mv_blocks,&data_blocks); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1132 #if 1 |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1133 if(rez != Success) |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1134 { |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1135 int i; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1136 printf("vo_xvmc::slice: RenderSirface returned %d\n",rez); |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1137 |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1138 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
|
1139 rndr->picture_structure,rndr->flags,rndr->start_mv_blocks_num, |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1140 rndr->filled_mv_blocks_num); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1141 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
|
1142 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
|
1143 |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1144 for(i=0; i<rndr->filled_mv_blocks_num; i++){ |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1145 XvMCMacroBlock* testblock; |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1146 testblock = &mv_blocks.macro_blocks[i]; |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1147 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1148 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
|
1149 testblock->x,testblock->y,testblock->macroblock_type, |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1150 testblock->motion_type,testblock->motion_vertical_field_select); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1151 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
|
1152 testblock->dct_type,testblock->index,testblock->coded_block_pattern, |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1153 testblock->pad0); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1154 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
|
1155 testblock->PMV[0][0][0],testblock->PMV[0][0][1]); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1156 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1157 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1158 #endif |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1159 assert(rez==Success); |
17932 | 1160 if( mp_msg_test(MSGT_VO,MSGL_DBG4) ) printf("vo_xvmc: flush surface\n"); |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1161 rez = XvMCFlushSurface(mDisplay, rndr->p_surface); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1162 assert(rez==Success); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1163 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1164 // rndr->start_mv_blocks_num += rndr->filled_mv_blocks_num; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1165 rndr->start_mv_blocks_num = 0; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1166 rndr->filled_mv_blocks_num = 0; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1167 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1168 rndr->next_free_data_block_num = 0; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1169 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1170 return VO_TRUE; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1171 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1172 |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1173 //XvMCHide hides the surface on next retrace, so |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1174 //check if the surface is not still displaying |
28202 | 1175 static void check_osd_source(struct xvmc_render_state * src_rndr){ |
1176 struct xvmc_render_state * osd_rndr; | |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1177 int stat; |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1178 //If this is source surface, check does the OSD rendering is compleate |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1179 if(src_rndr->state & MP_XVMC_STATE_OSD_SOURCE){ |
17932 | 1180 if( mp_msg_test(MSGT_VO,MSGL_DBG4) ) |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1181 printf("vo_xvmc: OSD surface=%p quering\n",src_rndr); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1182 osd_rndr = src_rndr->p_osd_target_surface_render; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1183 XvMCGetSurfaceStatus(mDisplay, osd_rndr->p_surface, &stat); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1184 if(!(stat & XVMC_RENDERING)) |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1185 src_rndr->state &= ~MP_XVMC_STATE_OSD_SOURCE; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1186 } |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1187 } |
28232
8df85ad26746
Add missing 'void' keyword to parameterless function declarations.
diego
parents:
28202
diff
changeset
|
1188 static int count_free_surfaces(void) { |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1189 int i,num; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1190 num=0; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1191 for(i=0; i<number_of_surfaces; i++){ |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1192 check_osd_source(&surface_render[i]); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1193 if(surface_render[i].state == 0) |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1194 num++; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1195 } |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1196 return num; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1197 } |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1198 |
28232
8df85ad26746
Add missing 'void' keyword to parameterless function declarations.
diego
parents:
28202
diff
changeset
|
1199 static struct xvmc_render_state * find_free_surface(void) { |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1200 int i,t; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1201 int stat; |
28202 | 1202 struct xvmc_render_state * visible_rndr; |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1203 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1204 visible_rndr = NULL; |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1205 for(i=0; i<number_of_surfaces; i++){ |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1206 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1207 check_osd_source(&surface_render[i]); |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1208 if( surface_render[i].state == 0){ |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1209 XvMCGetSurfaceStatus(mDisplay, surface_render[i].p_surface,&stat); |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1210 if( (stat & XVMC_DISPLAYING) == 0 ) |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1211 return &surface_render[i]; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1212 visible_rndr = &surface_render[i];// remember it, use as last resort |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1213 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1214 } |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1215 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1216 //all surfaces are busy, but there is one that will be free |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1217 //on next monitor retrace, we just have to wait |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1218 if(visible_rndr != NULL){ |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1219 printf("vo_xvmc: waiting retrace\n"); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1220 for(t=0;t<1000;t++){ |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1221 usec_sleep(1000);//1ms |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1222 XvMCGetSurfaceStatus(mDisplay, visible_rndr->p_surface,&stat); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1223 if( (stat & XVMC_DISPLAYING) == 0 ) |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1224 return visible_rndr; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1225 } |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1226 } |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1227 //todo remove when stable |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1228 printf("vo_xvmc: no free surfaces, this should not happen in g1\n"); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1229 for(i=0;i<number_of_surfaces;i++) |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1230 printf("vo_xvmc: surface[%d].state=%d\n",i,surface_render[i].state); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1231 return NULL; |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1232 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1233 |
22257
f979aa12d8cc
Don't free and then allocate surfaces when config() is called again with same resolution and format.
iive
parents:
22246
diff
changeset
|
1234 static void xvmc_clean_surfaces(void){ |
f979aa12d8cc
Don't free and then allocate surfaces when config() is called again with same resolution and format.
iive
parents:
22246
diff
changeset
|
1235 int i; |
f979aa12d8cc
Don't free and then allocate surfaces when config() is called again with same resolution and format.
iive
parents:
22246
diff
changeset
|
1236 |
f979aa12d8cc
Don't free and then allocate surfaces when config() is called again with same resolution and format.
iive
parents:
22246
diff
changeset
|
1237 for(i=0; i<number_of_surfaces; i++){ |
f979aa12d8cc
Don't free and then allocate surfaces when config() is called again with same resolution and format.
iive
parents:
22246
diff
changeset
|
1238 |
f979aa12d8cc
Don't free and then allocate surfaces when config() is called again with same resolution and format.
iive
parents:
22246
diff
changeset
|
1239 surface_render[i].state&=!( MP_XVMC_STATE_DISPLAY_PENDING | |
f979aa12d8cc
Don't free and then allocate surfaces when config() is called again with same resolution and format.
iive
parents:
22246
diff
changeset
|
1240 MP_XVMC_STATE_OSD_SOURCE | |
f979aa12d8cc
Don't free and then allocate surfaces when config() is called again with same resolution and format.
iive
parents:
22246
diff
changeset
|
1241 0); |
f979aa12d8cc
Don't free and then allocate surfaces when config() is called again with same resolution and format.
iive
parents:
22246
diff
changeset
|
1242 surface_render[i].p_osd_target_surface_render=NULL; |
f979aa12d8cc
Don't free and then allocate surfaces when config() is called again with same resolution and format.
iive
parents:
22246
diff
changeset
|
1243 if(surface_render[i].state != 0){ |
f979aa12d8cc
Don't free and then allocate surfaces when config() is called again with same resolution and format.
iive
parents:
22246
diff
changeset
|
1244 mp_msg(MSGT_VO,MSGL_WARN,"vo_xvmc: surface[%d].state=%d\n", |
f979aa12d8cc
Don't free and then allocate surfaces when config() is called again with same resolution and format.
iive
parents:
22246
diff
changeset
|
1245 i,surface_render[i].state); |
f979aa12d8cc
Don't free and then allocate surfaces when config() is called again with same resolution and format.
iive
parents:
22246
diff
changeset
|
1246 } |
f979aa12d8cc
Don't free and then allocate surfaces when config() is called again with same resolution and format.
iive
parents:
22246
diff
changeset
|
1247 } |
f979aa12d8cc
Don't free and then allocate surfaces when config() is called again with same resolution and format.
iive
parents:
22246
diff
changeset
|
1248 free_element=0;//clean up the queue |
f979aa12d8cc
Don't free and then allocate surfaces when config() is called again with same resolution and format.
iive
parents:
22246
diff
changeset
|
1249 } |
f979aa12d8cc
Don't free and then allocate surfaces when config() is called again with same resolution and format.
iive
parents:
22246
diff
changeset
|
1250 |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1251 static uint32_t get_image(mp_image_t *mpi){ |
28202 | 1252 struct xvmc_render_state * rndr; |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1253 |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1254 rndr = find_free_surface(); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1255 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1256 if(rndr == NULL){ |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1257 printf("vo_xvmc: get_image failed\n"); |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1258 return VO_FALSE; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1259 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1260 |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1261 assert(rndr->start_mv_blocks_num == 0); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1262 assert(rndr->filled_mv_blocks_num == 0); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1263 assert(rndr->next_free_data_block_num == 0); |
10452 | 1264 |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1265 mpi->flags |= MP_IMGFLAG_DIRECT; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1266 //keep strides 0 to avoid field manipulations |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1267 mpi->stride[0] = 0; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1268 mpi->stride[1] = 0; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1269 mpi->stride[2] = 0; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1270 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1271 // these are shared!! so watch out |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1272 // do call RenderSurface before overwriting |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1273 mpi->planes[0] = (char*)data_blocks.blocks; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1274 mpi->planes[1] = (char*)mv_blocks.macro_blocks; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1275 mpi->priv = |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1276 mpi->planes[2] = (char*)rndr; |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1277 |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1278 rndr->picture_structure = 0; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1279 rndr->flags = 0; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1280 rndr->state = 0; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1281 rndr->start_mv_blocks_num = 0; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1282 rndr->filled_mv_blocks_num = 0; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1283 rndr->next_free_data_block_num = 0; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1284 |
17932 | 1285 if( mp_msg_test(MSGT_VO,MSGL_DBG4) ) |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1286 printf("vo_xvmc: get_image: rndr=%p (surface=%p) \n", |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1287 rndr,rndr->p_surface); |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1288 return VO_TRUE; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1289 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1290 |
16171
fd51fd1ff231
Fix the return types of all (six) libvo API functions. Used to be uint32_t, but
ivo
parents:
15866
diff
changeset
|
1291 static int control(uint32_t request, void *data, ... ) |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1292 { |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1293 switch (request){ |
20973
c0bcec5150a3
Add deinterlace property, patch by Carl Eugen Hoyos
reimar
parents:
20244
diff
changeset
|
1294 case VOCTRL_GET_DEINTERLACE: |
c0bcec5150a3
Add deinterlace property, patch by Carl Eugen Hoyos
reimar
parents:
20244
diff
changeset
|
1295 *(int*)data = bob_deinterlace; |
c0bcec5150a3
Add deinterlace property, patch by Carl Eugen Hoyos
reimar
parents:
20244
diff
changeset
|
1296 return VO_TRUE; |
c0bcec5150a3
Add deinterlace property, patch by Carl Eugen Hoyos
reimar
parents:
20244
diff
changeset
|
1297 case VOCTRL_SET_DEINTERLACE: |
21002
1de63b07a353
more mp_property_deinterlace simplification, patch by
reimar
parents:
20973
diff
changeset
|
1298 bob_deinterlace = *(int*)data; |
20973
c0bcec5150a3
Add deinterlace property, patch by Carl Eugen Hoyos
reimar
parents:
20244
diff
changeset
|
1299 return VO_TRUE; |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1300 case VOCTRL_QUERY_FORMAT: |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1301 return query_format(*((uint32_t*)data)); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1302 case VOCTRL_DRAW_IMAGE: |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1303 return xvmc_draw_image((mp_image_t *)data); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1304 case VOCTRL_GET_IMAGE: |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1305 return get_image((mp_image_t *)data); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1306 //vo_xv |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1307 case VOCTRL_GUISUPPORT: |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1308 return VO_TRUE; |
11542 | 1309 case VOCTRL_ONTOP: |
1310 vo_x11_ontop(); | |
1311 return VO_TRUE; | |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1312 case VOCTRL_FULLSCREEN: |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1313 vo_x11_fullscreen(); |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1314 // indended, fallthrough to update panscan on fullscreen/windowed switch |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1315 case VOCTRL_SET_PANSCAN: |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1316 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
|
1317 { |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1318 int old_y = vo_panscan_y; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1319 panscan_calc(); |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1320 |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1321 if(old_y != vo_panscan_y) |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1322 { |
15102
1d3ba9fb75cd
incorporate all image drawing in single function and use fixed vo_xv_draw_colorkey() for proper key drawing.
iive
parents:
15060
diff
changeset
|
1323 //this also draws the colorkey |
1d3ba9fb75cd
incorporate all image drawing in single function and use fixed vo_xv_draw_colorkey() for proper key drawing.
iive
parents:
15060
diff
changeset
|
1324 put_xvmc_image(p_render_surface_visible,1); |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1325 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1326 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1327 return VO_TRUE; |
15151 | 1328 case VOCTRL_GET_PANSCAN: |
1329 if ( !vo_config_count || !vo_fs ) return VO_FALSE; | |
1330 return VO_TRUE; | |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1331 case VOCTRL_SET_EQUALIZER: |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1332 { |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1333 va_list ap; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1334 int value; |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1335 |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1336 va_start(ap, data); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1337 value = va_arg(ap, int); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1338 va_end(ap); |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1339 |
26755
46f0b4d34fa1
cosmetics: Remove useless parentheses from from return statements.
diego
parents:
26730
diff
changeset
|
1340 return vo_xv_set_eq(xv_port, data, value); |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1341 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1342 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1343 case VOCTRL_GET_EQUALIZER: |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1344 { |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1345 va_list ap; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1346 int *value; |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1347 |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1348 va_start(ap, data); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1349 value = va_arg(ap, int*); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1350 va_end(ap); |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1351 |
26755
46f0b4d34fa1
cosmetics: Remove useless parentheses from from return statements.
diego
parents:
26730
diff
changeset
|
1352 return vo_xv_get_eq(xv_port, data, value); |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1353 } |
22232 | 1354 case VOCTRL_UPDATE_SCREENINFO: |
1355 update_xinerama_info(); | |
1356 return VO_TRUE; | |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1357 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1358 return VO_NOTIMPL; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1359 } |