Mercurial > mplayer.hg
annotate libvo/vo_xvmc.c @ 13073:d2eb0ab395bc
ffsonic
author | alex |
---|---|
date | Sat, 21 Aug 2004 19:22:11 +0000 |
parents | 1c2f6de431bf |
children | e19b46309883 |
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" |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
10 #include "fastmemcpy.h" |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
11 #include "osdep/timer.h" |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
12 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
13 #include <X11/Xlib.h> |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
14 #include <X11/Xutil.h> |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
15 #include <X11/Xatom.h> |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
16 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
17 #ifdef HAVE_SHM |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
18 #include <sys/ipc.h> |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
19 #include <sys/shm.h> |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
20 #include <X11/extensions/XShm.h> |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
21 #endif |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
22 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
23 #include <X11/extensions/Xv.h> |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
24 #include <X11/extensions/Xvlib.h> |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
25 #include <X11/extensions/XvMClib.h> |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
26 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
27 #include "x11_common.h" |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
28 #include "xvmc_render.h" |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
29 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
30 #include "sub.h" |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
31 #include "aspect.h" |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
32 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
33 #ifdef HAVE_NEW_GUI |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
34 #include "../Gui/interface.h" |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
35 #endif |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
36 |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
37 //no chanse xinerama to be suported in near future |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
38 #undef HAVE_XINERAMA |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
39 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
40 #undef NDEBUG |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
41 #include <assert.h> |
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 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
44 #define UNUSED(x) ((void)(x)) |
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 extern int vo_directrendering; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
48 extern int vo_verbose; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
49 |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
50 static int benchmark; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
51 static int busy_wait; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
52 static int use_queue; |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
53 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
54 static int image_width,image_height; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
55 static uint32_t drwX,drwY; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
56 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
57 static XvPortID xv_port; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
58 |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
59 #define AUTO_COLORKEY 0 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
60 #define BACKGROUND_COLORKEY 1 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
61 #define AUTOPAINT_COLORKEY 2 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
62 #define MANUALFILL_COLORKEY 3 |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
63 static int keycolor_handling; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
64 static unsigned long keycolor; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
65 |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
66 #define NO_SUBPICTURE 0 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
67 #define OVERLAY_SUBPICTURE 1 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
68 #define BLEND_SUBPICTURE 2 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
69 #define BACKEND_SUBPICTURE 3 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
70 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
71 static int subpicture_mode; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
72 static int subpicture_alloc; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
73 static XvMCSubpicture subpicture; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
74 static XvImageFormatValues subpicture_info; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
75 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
|
76 |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
77 static XvMCSurfaceInfo surface_info; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
78 static XvMCContext ctx; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
79 static XvMCBlockArray data_blocks; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
80 static XvMCMacroBlockArray mv_blocks; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
81 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
82 #define MAX_SURFACES 8 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
83 static int number_of_surfaces=0; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
84 static XvMCSurface surface_array[MAX_SURFACES]; |
10452 | 85 static xvmc_render_state_t * surface_render; |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
86 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
87 static xvmc_render_state_t * p_render_surface_to_show=NULL; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
88 static xvmc_render_state_t * p_render_surface_visible=NULL; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
89 |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
90 //display queue, kinda render ahead |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
91 static xvmc_render_state_t * show_queue[MAX_SURFACES]; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
92 static int free_element; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
93 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
94 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
95 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
|
96 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
|
97 static void (*init_osd_fnc)(void); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
98 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
99 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
|
100 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
|
101 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
|
102 static void init_osd_yuv_pal(void); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
103 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
104 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
105 static const struct{ |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
106 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
|
107 void (* init_func_ptr)(); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
108 void (* draw_func_ptr)(); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
109 void (* clear_func_ptr)(); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
110 } osd_render[]={ |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
111 {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
|
112 {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
|
113 {0,NULL,NULL,NULL} |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
114 }; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
115 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
116 static void xvmc_free(void); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
117 static int count_free_surfaces(); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
118 static xvmc_render_state_t * find_free_surface(); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
119 |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
120 static vo_info_t info = { |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
121 "XVideo Motion Compensation", |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
122 "xvmc", |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
123 "Ivan Kalvachev <iive@users.sf.net>", |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
124 "" |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
125 }; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
126 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
127 LIBVO_EXTERN(xvmc); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
128 |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
129 //shm stuff from vo_xv |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
130 #ifdef HAVE_SHM |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
131 /* since it doesn't seem to be defined on some platforms */ |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
132 int XShmGetEventBase(Display*); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
133 static XShmSegmentInfo Shminfo; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
134 static int Shmem_Flag; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
135 #endif |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
136 XvImage * xvimage; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
137 |
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 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
|
140 { |
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 * allocate XvImages. FIXME: no error checking, without |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
143 * 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
|
144 */ |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
145 #ifdef HAVE_SHM |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
146 if ( mLocalDisplay && XShmQueryExtension( mDisplay ) ) Shmem_Flag = 1; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
147 else |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
148 { |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
149 Shmem_Flag = 0; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
150 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
|
151 } |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
152 if ( Shmem_Flag ) |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
153 { |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
154 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
|
155 NULL, xvimage_width, xvimage_height, &Shminfo); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
156 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
157 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
|
158 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
|
159 Shminfo.readOnly = False; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
160 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
161 xvimage->data = Shminfo.shmaddr; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
162 XShmAttach(mDisplay, &Shminfo); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
163 XSync(mDisplay, False); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
164 shmctl(Shminfo.shmid, IPC_RMID, 0); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
165 } |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
166 else |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
167 #endif |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
168 { |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
169 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
|
170 xvimage->data = malloc(xvimage->data_size); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
171 XSync(mDisplay,False); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
172 } |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
173 // memset(xvimage->data,128,xvimage->data_size); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
174 return; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
175 } |
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 static void deallocate_xvimage() |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
178 { |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
179 #ifdef HAVE_SHM |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
180 if ( Shmem_Flag ) |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
181 { |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
182 XShmDetach( mDisplay,&Shminfo ); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
183 shmdt( Shminfo.shmaddr ); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
184 } |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
185 else |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
186 #endif |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
187 { |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
188 free(xvimage->data); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
189 } |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
190 XFree(xvimage); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
191 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
192 XSync(mDisplay, False); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
193 return; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
194 } |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
195 //end of vo_xv shm/xvimage code |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
196 |
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 void init_keycolor(){ |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
199 Atom xv_atom; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
200 XvAttribute * attributes; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
201 int colorkey; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
202 int rez; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
203 int attrib_count,i; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
204 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
205 keycolor=2110; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
206 |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
207 if(keycolor_handling == AUTO_COLORKEY){ |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
208 //XV_AUTOPING_COLORKEY doesn't work for XvMC yet(NVidia 43.63) |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
209 attributes = XvQueryPortAttributes(mDisplay, xv_port, &attrib_count); |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
210 if(attributes!=NULL) |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
211 for (i = 0; i < attrib_count; i++) |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
212 if (!strcmp(attributes[i].name, "XV_AUTOPAINT_COLORKEY")) |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
213 { |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
214 xv_atom = XInternAtom(mDisplay, "XV_AUTOPAINT_COLORKEY", False); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
215 if(xv_atom!=None) |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
216 { |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
217 rez=XvSetPortAttribute(mDisplay, xv_port, xv_atom, 1); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
218 if(rez == Success) |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
219 keycolor_handling = AUTOPAINT_COLORKEY; |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
220 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
221 break; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
222 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
223 XFree(attributes); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
224 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
225 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
226 xv_atom = XInternAtom(mDisplay, "XV_COLORKEY",False); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
227 if(xv_atom == None) return; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
228 rez=XvGetPortAttribute(mDisplay,xv_port, xv_atom, &colorkey); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
229 if(rez == Success){ |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
230 keycolor = colorkey; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
231 if(keycolor_handling == AUTO_COLORKEY){ |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
232 keycolor_handling = MANUALFILL_COLORKEY; |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
233 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
234 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
235 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
236 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
237 //from vo_xmga |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
238 static void mDrawColorKey(uint32_t x,uint32_t y, uint32_t w, uint32_t h) |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
239 { |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
240 if( (keycolor_handling != AUTOPAINT_COLORKEY) && |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
241 (keycolor_handling != MANUALFILL_COLORKEY) ) |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
242 return; |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
243 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
244 XSetBackground( mDisplay,vo_gc,0 ); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
245 XClearWindow( mDisplay,vo_window ); |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
246 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
247 if(keycolor_handling == MANUALFILL_COLORKEY){ |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
248 XSetForeground( mDisplay,vo_gc,keycolor ); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
249 XFillRectangle( mDisplay,vo_window,vo_gc,x,y,w,h); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
250 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
251 XFlush( mDisplay ); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
252 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
253 |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
254 |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
255 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
|
256 if ( format == IMGFMT_XVMC_IDCT_MPEG2 ){ |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
257 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
|
258 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
|
259 return 0; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
260 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
261 if ( format == IMGFMT_XVMC_MOCO_MPEG2 ){ |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
262 if(surf_info->mc_type != XVMC_MPEG_2) return -1; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
263 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
|
264 return 0; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
265 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
266 return -1;//fail |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
267 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
268 |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
269 //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
|
270 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
|
271 int i; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
272 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
|
273 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
274 printf(" type = "); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
275 if(xifv->type == XvRGB) printf("RGB\n"); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
276 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
|
277 else printf("Unknown\n"); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
278 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
279 printf(" byte_order = "); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
280 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
|
281 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
|
282 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
|
283 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
284 printf(" guid = "); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
285 for(i=0;i<16;i++) |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
286 printf("%02X ",(unsigned char)xifv->guid[i]); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
287 printf("\n"); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
288 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
289 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
|
290 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
291 printf(" format = "); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
292 if(xifv->format == XvPacked) printf("XvPacked\n"); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
293 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
|
294 else printf("Unknown\n"); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
295 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
296 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
|
297 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
298 if(xifv->type == XvRGB){ |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
299 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
|
300 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
|
301 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
|
302 } |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
303 if(xifv->type == XvYUV){ |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
304 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
|
305 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
|
306 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
|
307 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
|
308 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
|
309 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
|
310 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
311 printf(" component_order = "); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
312 for(i=0;i<32;i++) |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
313 if(xifv->component_order[i]>=32) |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
314 printf("%c",xifv->component_order[i]); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
315 printf("\n"); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
316 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
317 printf(" scanline = "); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
318 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
|
319 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
|
320 else printf("Unknown\n"); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
321 } |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
322 printf("\n"); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
323 } |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
324 |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
325 // 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
|
326 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
|
327 XvMCSurfaceInfo * surf_info,int query){ |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
328 int rez; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
329 XvAdaptorInfo * ai; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
330 int num_adaptors,i; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
331 unsigned long p; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
332 int s,mc_surf_num; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
333 XvMCSurfaceInfo * mc_surf_list; |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
334 |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
335 rez = XvQueryAdaptors(mDisplay,DefaultRootWindow(mDisplay),&num_adaptors,&ai); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
336 if( rez != Success ) return -1; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
337 if( verbose > 2 ) printf("vo_xvmc: Querying %d adaptors\n",num_adaptors); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
338 for(i=0; i<num_adaptors; i++) |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
339 { |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
340 if( verbose > 2) printf("vo_xvmc: Quering adaptor #%d\n",i); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
341 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
|
342 //probing ports |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
343 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
|
344 { |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
345 if( verbose > 2) printf("vo_xvmc: probing port #%ld\n",p); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
346 mc_surf_list = XvMCListSurfaceTypes(mDisplay,p,&mc_surf_num); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
347 if( mc_surf_list == NULL || mc_surf_num == 0){ |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
348 if( verbose > 2) printf("vo_xvmc: No XvMC supported. \n"); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
349 continue; |
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 if( verbose > 2) printf("vo_xvmc: XvMC list have %d surfaces\n",mc_surf_num); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
352 //we have XvMC list! |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
353 for(s=0; s<mc_surf_num; s++) |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
354 { |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
355 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
|
356 if( height > mc_surf_list[s].max_height ) continue; |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
357 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
|
358 //we have match! |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
359 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
360 if(!query){ |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
361 rez = XvGrabPort(mDisplay,p,CurrentTime); |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
362 if(rez != Success){ |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
363 if (verbose > 2) printf("vo_xvmc: Fail to grab port %ld\n",p); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
364 continue; |
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 printf("vo_xvmc: Port %ld grabed\n",p); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
367 xv_port = p; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
368 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
369 goto surface_found; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
370 }//for mc surf |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
371 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
|
372 }//for ports |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
373 }//for adaptors |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
374 |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
375 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
|
376 return 0; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
377 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
378 // somebody know cleaner way to escape from 3 internal loops? |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
379 surface_found: |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
380 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
381 memcpy(surf_info,&mc_surf_list[s],sizeof(XvMCSurfaceInfo)); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
382 if( verbose > 2 || !query) |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
383 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
|
384 mc_surf_list[s].surface_type_id,p,i); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
385 return mc_surf_list[s].surface_type_id; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
386 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
387 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
388 static uint32_t xvmc_draw_image(mp_image_t *mpi){ |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
389 xvmc_render_state_t * rndr; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
390 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
391 assert(mpi!=NULL); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
392 assert(mpi->flags &MP_IMGFLAG_DIRECT); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
393 // assert(mpi->flags &MP_IMGFLAGS_DRAWBACK); |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
394 |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
395 rndr = (xvmc_render_state_t*)mpi->priv;//there is copy in plane[2] |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
396 assert( rndr != NULL ); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
397 assert( rndr->magic == MP_XVMC_RENDER_MAGIC ); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
398 if( verbose > 3 ) |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
399 printf("vo_xvmc: draw_image(show rndr=%p)\n",rndr); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
400 // 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
|
401 rndr->state |= MP_XVMC_STATE_DISPLAY_PENDING; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
402 p_render_surface_to_show = rndr; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
403 return VO_TRUE; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
404 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
405 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
406 static uint32_t preinit(const char *arg){ |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
407 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
|
408 int mc_eventBase,mc_errorBase; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
409 int mc_ver,mc_rev; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
410 |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
411 //Obtain display handler |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
412 if (!vo_init()) return -1;//vo_xv |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
413 |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
414 //XvMC is subdivision of XVideo |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
415 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
|
416 &xv_event_base,&xv_error_base) ){ |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
417 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
|
418 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
|
419 return -1; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
420 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
421 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
|
422 |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
423 if( True != XvMCQueryExtension(mDisplay,&mc_eventBase,&mc_errorBase) ){ |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
424 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
|
425 XDisplayName(NULL)); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
426 return -1; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
427 } |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
428 |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
429 if(Success == XvMCQueryVersion(mDisplay, &mc_ver, &mc_rev) ){ |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
430 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
|
431 mc_ver,mc_rev); |
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 else{ |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
434 printf("vo_xvmc: Error querying version info!\n"); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
435 return -1; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
436 } |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
437 surface_render = NULL; |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
438 xv_port = 0; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
439 number_of_surfaces = 0; |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
440 keycolor_handling = MANUALFILL_COLORKEY;//fixme |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
441 subpicture_alloc = 0; |
10452 | 442 |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
443 benchmark = 0; //disable PutImageto allow faster display than screen refresh |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
444 busy_wait = 1; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
445 use_queue = 0; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
446 if(arg) |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
447 while(*arg){ |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
448 if(strncmp(arg,"benchmark",9) == 0){ |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
449 arg+=9; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
450 if(*arg == ':') arg++; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
451 benchmark = 1;//disable PutImageto allow faster display than screen refresh |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
452 continue; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
453 } |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
454 if(strncmp(arg,"wait",4) == 0){ |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
455 arg+=4; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
456 if(*arg == ':') arg++; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
457 busy_wait = 1; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
458 continue; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
459 } |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
460 if(strncmp(arg,"sleep",5) == 0){ |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
461 arg+=5; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
462 if(*arg == ':') arg++; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
463 busy_wait = 0; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
464 continue; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
465 } |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
466 if(strncmp(arg,"queue",5) == 0){ |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
467 arg+=5; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
468 if(*arg == ':') arg++; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
469 use_queue = 1; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
470 continue; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
471 } |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
472 break; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
473 } |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
474 |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
475 return 0; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
476 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
477 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
478 static uint32_t config(uint32_t width, uint32_t height, |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
479 uint32_t d_width, uint32_t d_height, |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
480 uint32_t flags, char *title, uint32_t format){ |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
481 int i,mode_id,rez; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
482 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
|
483 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
484 //from vo_xv |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
485 char *hello = (title == NULL) ? "XvMC render" : title; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
486 XSizeHints hint; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
487 XVisualInfo vinfo; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
488 XGCValues xgcv; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
489 XSetWindowAttributes xswa; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
490 XWindowAttributes attribs; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
491 unsigned long xswamask; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
492 int depth; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
493 #ifdef HAVE_XF86VM |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
494 int vm=0; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
495 unsigned int modeline_width, modeline_height; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
496 static uint32_t vm_width; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
497 static uint32_t vm_height; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
498 #endif |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
499 //end of vo_xv |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
500 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
501 if( !IMGFMT_IS_XVMC(format) ) |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
502 { |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
503 assert(0);//should never happen, abort on debug or |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
504 return 1;//return error on relese |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
505 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
506 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
507 // Find free port that supports MC, by querying adaptors |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
508 if( xv_port != 0 || number_of_surfaces != 0 ){ |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
509 xvmc_free(); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
510 }; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
511 numblocks=((width+15)/16)*((height+15)/16); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
512 // Find Supported Surface Type |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
513 mode_id = xvmc_find_surface_by_format(format,width,height,&surface_info,0);//false=1 to grab port, not query |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
514 |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
515 rez = XvMCCreateContext(mDisplay, xv_port,mode_id,width,height,XVMC_DIRECT,&ctx); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
516 if( rez != Success ) return -1; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
517 if( ctx.flags & XVMC_DIRECT ){ |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
518 printf("vo_xvmc: Allocated Direct Context\n"); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
519 }else{ |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
520 printf("vo_xvmc: Allocated Indirect Context!\n"); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
521 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
522 |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
523 |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
524 blocks_per_macroblock = 6; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
525 if(surface_info.chroma_format == XVMC_CHROMA_FORMAT_422) |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
526 blocks_per_macroblock = 8; |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
527 if(surface_info.chroma_format == XVMC_CHROMA_FORMAT_444) |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
528 blocks_per_macroblock = 12; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
529 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
530 rez = XvMCCreateBlocks(mDisplay,&ctx,numblocks*blocks_per_macroblock,&data_blocks); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
531 if( rez != Success ){ |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
532 XvMCDestroyContext(mDisplay,&ctx); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
533 return -1; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
534 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
535 printf("vo_xvmc: data_blocks allocated\n"); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
536 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
537 rez = XvMCCreateMacroBlocks(mDisplay,&ctx,numblocks,&mv_blocks); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
538 if( rez != Success ){ |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
539 XvMCDestroyBlocks(mDisplay,&data_blocks); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
540 XvMCDestroyContext(mDisplay,&ctx); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
541 return -1; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
542 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
543 printf("vo_xvmc: mv_blocks allocated\n"); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
544 |
10452 | 545 if(surface_render==NULL) |
546 surface_render=malloc(MAX_SURFACES*sizeof(xvmc_render_state_t));//easy mem debug | |
11415 | 547 memset(surface_render,0,MAX_SURFACES*sizeof(xvmc_render_state_t)); |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
548 |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
549 for(i=0; i<MAX_SURFACES; i++){ |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
550 rez=XvMCCreateSurface(mDisplay,&ctx,&surface_array[i]); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
551 if( rez != Success ) |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
552 break; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
553 surface_render[i].magic = MP_XVMC_RENDER_MAGIC; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
554 surface_render[i].data_blocks = data_blocks.blocks; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
555 surface_render[i].mv_blocks = mv_blocks.macro_blocks; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
556 surface_render[i].total_number_of_mv_blocks = numblocks; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
557 surface_render[i].total_number_of_data_blocks = numblocks*blocks_per_macroblock;; |
10452 | 558 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
|
559 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
|
560 surface_render[i].chroma_format = surface_info.chroma_format; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
561 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
|
562 surface_render[i].p_surface = &surface_array[i]; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
563 if( verbose > 3 ) |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
564 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
|
565 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
566 number_of_surfaces = i; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
567 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
|
568 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
|
569 uninit(); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
570 return -1; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
571 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
572 printf("vo_xvmc: Motion Compensation context allocated - %d surfaces\n", |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
573 number_of_surfaces); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
574 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
575 //debug |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
576 printf("vo_xvmc: idct=%d unsigned_intra=%d\n", |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
577 (surface_info.mc_type & XVMC_IDCT) == XVMC_IDCT, |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
578 (surface_info.flags & XVMC_INTRA_UNSIGNED) == XVMC_INTRA_UNSIGNED); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
579 |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
580 // Find way to display OSD & subtitle |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
581 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
|
582 subpicture_mode = NO_SUBPICTURE; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
583 if(surface_info.flags & XVMC_OVERLAID_SURFACE) |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
584 subpicture_mode = OVERLAY_SUBPICTURE; |
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 if(surface_info.subpicture_max_width != 0 && |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
587 surface_info.subpicture_max_height != 0 ){ |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
588 int s,k,num_subpic; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
589 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
590 XvImageFormatValues * xvfmv; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
591 xvfmv = XvMCListSubpictureTypes(mDisplay, xv_port, |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
592 surface_info.surface_type_id, &num_subpic); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
593 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
594 if(num_subpic != 0 && xvfmv != NULL){ |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
595 if(verbose > 3){//Print All subpicture types for debug |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
596 for(s=0;s<num_subpic;s++) |
11415 | 597 print_xvimage_format_values(&xvfmv[s]); |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
598 } |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
599 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
600 for(s=0;s<num_subpic;s++){ |
10714 | 601 for(k=0;osd_render[k].draw_func_ptr!=NULL;k++){ |
602 if(xvfmv[s].id == osd_render[k].id) | |
603 { | |
604 init_osd_fnc = osd_render[k].init_func_ptr; | |
605 draw_osd_fnc = osd_render[k].draw_func_ptr; | |
606 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
|
607 |
10714 | 608 subpicture_mode = BLEND_SUBPICTURE; |
609 subpicture_info = xvfmv[s]; | |
11415 | 610 printf(" Subpicture id 0x%08X\n",subpicture_info.id); |
10714 | 611 goto found_subpic; |
612 } | |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
613 } |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
614 } |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
615 found_subpic: |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
616 XFree(xvfmv); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
617 } |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
618 //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
|
619 if( (subpicture_mode == BLEND_SUBPICTURE) && |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
620 (surface_info.flags & XVMC_BACKEND_SUBPICTURE) ) |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
621 { |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
622 subpicture_mode = BACKEND_SUBPICTURE; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
623 } |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
624 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
625 } |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
626 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
627 switch(subpicture_mode){ |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
628 case NO_SUBPICTURE: |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
629 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
|
630 break; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
631 case OVERLAY_SUBPICTURE: |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
632 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
|
633 printf("vo_xvmc: not yet implemented:(\n"); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
634 break; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
635 case BLEND_SUBPICTURE: |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
636 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
|
637 break; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
638 case BACKEND_SUBPICTURE: |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
639 printf("vo_xvmc: OSD support by beckend rendering (fast)\n"); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
640 printf("vo_xvmc: Pleace send feedback to configrm that it work,otherwise send bugreport!\n"); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
641 break; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
642 } |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
643 |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
644 init_keycolor();// take keycolor value and choose method for handling it |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
645 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
646 //taken from vo_xv |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
647 panscan_init(); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
648 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
649 aspect_save_orig(width,height); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
650 aspect_save_prescale(d_width,d_height); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
651 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
652 image_height = height; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
653 image_width = width; |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
654 |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
655 vo_mouse_autohide = 1; |
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 vo_dx=( vo_screenwidth - d_width ) / 2; vo_dy=( vo_screenheight - d_height ) / 2; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
658 geometry(&vo_dx, &vo_dy, &d_width, &d_height, vo_screenwidth, vo_screenheight); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
659 vo_dwidth=d_width; vo_dheight=d_height; |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
660 |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
661 #ifdef HAVE_XF86VM |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
662 if( flags&0x02 ) vm = 1; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
663 #endif |
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 aspect_save_screenres(vo_screenwidth,vo_screenheight); |
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 #ifdef HAVE_NEW_GUI |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
668 if(use_gui) |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
669 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
|
670 else |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
671 #endif |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
672 { |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
673 hint.x = vo_dx; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
674 hint.y = vo_dy; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
675 aspect(&d_width,&d_height,A_NOZOOM); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
676 hint.width = d_width; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
677 hint.height = d_height; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
678 #ifdef HAVE_XF86VM |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
679 if ( vm ) |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
680 { |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
681 if ((d_width==0) && (d_height==0)) |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
682 { vm_width=image_width; vm_height=image_height; } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
683 else |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
684 { vm_width=d_width; vm_height=d_height; } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
685 vo_vm_switch(vm_width, vm_height,&modeline_width, &modeline_height); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
686 hint.x=(vo_screenwidth-modeline_width)/2; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
687 hint.y=(vo_screenheight-modeline_height)/2; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
688 hint.width=modeline_width; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
689 hint.height=modeline_height; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
690 aspect_save_screenres(modeline_width,modeline_height); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
691 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
692 else |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
693 #endif |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
694 if ( vo_fs ) |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
695 { |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
696 #ifdef X11_FULLSCREEN |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
697 /* this code replaces X11_FULLSCREEN hack in mplayer.c |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
698 * aspect() is available through aspect.h for all vos. |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
699 * besides zooming should only be done with -zoom, |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
700 * but I leave the old -fs behaviour so users don't get |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
701 * irritated for now (and send lots o' mails ;) ::atmos |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
702 */ |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
703 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
704 aspect(&d_width,&d_height,A_ZOOM); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
705 #endif |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
706 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
707 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
708 vo_dwidth=d_width; vo_dheight=d_height; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
709 hint.flags = PPosition | PSize /* | PBaseSize */; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
710 hint.base_width = hint.width; hint.base_height = hint.height; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
711 XGetWindowAttributes(mDisplay, DefaultRootWindow(mDisplay), &attribs); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
712 depth=attribs.depth; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
713 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
|
714 XMatchVisualInfo(mDisplay, mScreen, depth, TrueColor, &vinfo); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
715 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
716 xswa.background_pixel = 0; |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
717 if (keycolor_handling == BACKGROUND_COLORKEY) |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
718 xswa.background_pixel = keycolor;// 2110; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
719 xswa.border_pixel = 0; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
720 xswamask = CWBackPixel | CWBorderPixel; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
721 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
722 if ( WinID>=0 ){ |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
723 vo_window = WinID ? ((Window)WinID) : mRootWin; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
724 if ( WinID ) |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
725 { |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
726 XUnmapWindow( mDisplay,vo_window ); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
727 XChangeWindowAttributes( mDisplay,vo_window,xswamask,&xswa ); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
728 vo_x11_selectinput_witherr( mDisplay,vo_window,StructureNotifyMask | KeyPressMask | PropertyChangeMask | PointerMotionMask | ButtonPressMask | ButtonReleaseMask | ExposureMask ); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
729 XMapWindow( mDisplay,vo_window ); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
730 } else { drwX=vo_dx; drwY=vo_dy; } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
731 } else |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
732 if ( vo_window == None ){ |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
733 vo_window = XCreateWindow(mDisplay, mRootWin, |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
734 hint.x, hint.y, hint.width, hint.height, |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
735 0, depth,CopyFromParent,vinfo.visual,xswamask,&xswa); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
736 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
737 vo_x11_classhint( mDisplay,vo_window,"xvmc" ); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
738 vo_hidecursor(mDisplay,vo_window); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
739 |
10497
9e6becbd5c8a
draw rectangle with color key, avoid blue bars. avoid PutSurface before 1'st image
iive
parents:
10452
diff
changeset
|
740 vo_x11_selectinput_witherr(mDisplay, vo_window, StructureNotifyMask | KeyPressMask | PropertyChangeMask | ExposureMask | |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
741 ((WinID==0) ? 0 : (PointerMotionMask |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
742 | ButtonPressMask | ButtonReleaseMask)) ); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
743 XSetStandardProperties(mDisplay, vo_window, hello, hello, None, NULL, 0, &hint); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
744 XSetWMNormalHints( mDisplay,vo_window,&hint ); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
745 XMapWindow(mDisplay, vo_window); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
746 if ( flags&1 ) vo_x11_fullscreen(); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
747 else { |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
748 #ifdef HAVE_XINERAMA |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
749 vo_x11_xinerama_move(mDisplay,vo_window); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
750 #endif |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
751 vo_x11_sizehint( hint.x, hint.y, hint.width, hint.height,0 ); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
752 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
753 } else { |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
754 // vo_fs set means we were already at fullscreen |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
755 vo_x11_sizehint( hint.x, hint.y, hint.width, hint.height,0 ); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
756 if ( !vo_fs ) XMoveResizeWindow( mDisplay,vo_window,hint.x,hint.y,hint.width,hint.height ); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
757 if ( flags&1 && !vo_fs ) vo_x11_fullscreen(); // handle -fs on non-first file |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
758 } |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
759 |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
760 // vo_x11_sizehint( hint.x, hint.y, hint.width, hint.height,0 ); |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
761 |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
762 if ( vo_gc != None ) XFreeGC( mDisplay,vo_gc ); |
10452 | 763 vo_gc = XCreateGC(mDisplay, vo_window, GCForeground, &xgcv); |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
764 XSync(mDisplay, False); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
765 #ifdef HAVE_XF86VM |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
766 if ( vm ) |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
767 { |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
768 /* Grab the mouse pointer in our window */ |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
769 if(vo_grabpointer) |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
770 XGrabPointer(mDisplay, vo_window, True, 0, |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
771 GrabModeAsync, GrabModeAsync, |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
772 vo_window, None, CurrentTime ); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
773 XSetInputFocus(mDisplay, vo_window, RevertToNone, CurrentTime); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
774 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
775 #endif |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
776 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
777 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
778 aspect(&vo_dwidth,&vo_dheight,A_NOZOOM); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
779 if ( (( flags&1 )&&( WinID <= 0 )) || vo_fs ) |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
780 { |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
781 aspect(&vo_dwidth,&vo_dheight,A_ZOOM); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
782 drwX=( vo_screenwidth - (vo_dwidth > vo_screenwidth?vo_screenwidth:vo_dwidth) ) / 2; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
783 drwY=( vo_screenheight - (vo_dheight > vo_screenheight?vo_screenheight:vo_dheight) ) / 2; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
784 vo_dwidth=(vo_dwidth > vo_screenwidth?vo_screenwidth:vo_dwidth); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
785 vo_dheight=(vo_dheight > vo_screenheight?vo_screenheight:vo_dheight); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
786 mp_msg(MSGT_VO,MSGL_V, "[xvmc-fs] dx: %d dy: %d dw: %d dh: %d\n",drwX,drwY,vo_dwidth,vo_dheight ); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
787 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
788 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
789 panscan_calc(); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
790 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
791 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
|
792 |
11542 | 793 if (vo_ontop) vo_x11_setlayer(mDisplay, vo_window, vo_ontop); |
794 | |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
795 //end vo_xv |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
796 |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
797 /* store image dimesions for displaying */ |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
798 p_render_surface_visible = NULL; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
799 p_render_surface_to_show = NULL; |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
800 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
801 free_element = 0; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
802 |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
803 vo_directrendering = 1;//ugly hack, coz xvmc works only with direct rendering |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
804 return 0; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
805 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
806 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
807 static uint32_t draw_frame(uint8_t *srcp[]){ |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
808 UNUSED(srcp); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
809 assert(0); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
810 } |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
811 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
812 static void init_osd_yuv_pal(){ |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
813 char * palette; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
814 int rez; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
815 int i,j; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
816 int snum,seb; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
817 int Y,U,V; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
818 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
819 subpicture_clear_color = 0; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
820 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
821 if(subpicture.num_palette_entries > 0){ |
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 snum = subpicture.num_palette_entries; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
824 seb = subpicture.entry_bytes; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
825 palette = (char*)malloc(snum*seb);//check fail |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
826 if(palette == NULL) return; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
827 for(i=0; i<snum; i++){ |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
828 // 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
|
829 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
|
830 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
|
831 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
|
832 for(j=0; j<seb; j++) |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
833 switch(subpicture.component_order[j]){ |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
834 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
|
835 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
|
836 case 'Y': |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
837 default: |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
838 palette[i*seb+j] = Y; break; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
839 } |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
840 } |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
841 rez = XvMCSetSubpicturePalette(mDisplay, &subpicture, palette); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
842 if(rez!=Success){ |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
843 printf("vo_xvmc: set pallete fail\n"); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
844 } |
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 } |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
847 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
848 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
|
849 int rez; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
850 rez=XvMCClearSubpicture(mDisplay, &subpicture, |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
851 x0, y0, w,h, |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
852 subpicture_clear_color); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
853 if(rez != Success) |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
854 printf("vo_xvmc: XvMCClearSubpicture failed!\n"); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
855 } |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
856 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
857 static void OSD_init(){ |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
858 unsigned short osd_height, osd_width; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
859 int rez; |
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(subpicture_alloc){ |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
862 if(verbose>3) |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
863 printf("vo_xvmc: destroying subpicture\n"); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
864 XvMCDestroySubpicture(mDisplay,&subpicture); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
865 deallocate_xvimage(); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
866 subpicture_alloc = 0; |
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 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
869 /* 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
|
870 osd_width = vo_dwidth; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
871 osd_height = vo_dheight; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
872 }else*/ |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
873 { |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
874 osd_width = image_width; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
875 osd_height = image_height; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
876 } |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
877 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
878 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
|
879 osd_width = surface_info.subpicture_max_width; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
880 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
|
881 osd_height = surface_info.subpicture_max_height; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
882 if(osd_width == 0 || osd_height == 0) |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
883 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
|
884 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
885 if(verbose > 3) |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
886 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
|
887 osd_width,osd_height,subpicture_info.id); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
888 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
889 rez = XvMCCreateSubpicture(mDisplay,&ctx,&subpicture, |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
890 osd_width,osd_height,subpicture_info.id); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
891 if(rez != Success){ |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
892 subpicture_mode = NO_SUBPICTURE; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
893 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
|
894 return; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
895 } |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
896 if(verbose > 3){ |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
897 int i; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
898 printf("vo_xvmc: Created Subpicture:\n"); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
899 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
|
900 printf(" width=%d\n",subpicture.width); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
901 printf(" height=%d\n",subpicture.height); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
902 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
|
903 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
|
904 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
905 printf(" component_order=\""); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
906 for(i=0; i<4; i++) |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
907 if(subpicture.component_order[i] >= 32) |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
908 printf("%c", subpicture.component_order[i]); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
909 printf("\"\n"); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
910 } |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
911 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
912 //call init for the surface type |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
913 init_osd_fnc();//init palete,clear color etc ... |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
914 if(verbose > 3) |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
915 printf("vo_xvmc: clearing subpicture\n"); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
916 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
|
917 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
918 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
|
919 subpicture_alloc = 1; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
920 } |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
921 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
922 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
|
923 int ox,oy; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
924 int rez; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
925 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
926 if(verbose > 3) |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
927 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
|
928 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
929 for(ox=0; ox<w; ox++){ |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
930 for(oy=0; oy<h; oy++){ |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
931 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
|
932 } |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
933 } |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
934 rez = XvMCCompositeSubpicture(mDisplay, &subpicture, xvimage, 0, 0, |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
935 w,h,x0,y0); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
936 if(rez != Success){ |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
937 printf("vo_xvmc: composite subpicture failed\n"); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
938 assert(0); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
939 } |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
940 } |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
941 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
942 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
|
943 int ox,oy; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
944 int rez; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
945 if( verbose > 3) |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
946 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
|
947 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
948 for(ox=0; ox<w; ox++){ |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
949 for(oy=0; oy<h; oy++){ |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
950 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
|
951 } |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
952 } |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
953 rez = XvMCCompositeSubpicture(mDisplay, &subpicture, xvimage, 0, 0, |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
954 w,h,x0,y0); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
955 if(rez != Success){ |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
956 printf("vo_xvmc: composite subpicture failed\n"); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
957 assert(0); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
958 } |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
959 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
960 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
961 static void draw_osd(void){ |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
962 xvmc_render_state_t * osd_rndr; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
963 int osd_has_changed; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
964 int have_osd_to_draw; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
965 int rez; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
966 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
967 if(verbose > 3) |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
968 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
|
969 subpicture_mode,p_render_surface_to_show); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
970 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
971 if(subpicture_mode == BLEND_SUBPICTURE || |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
972 subpicture_mode == BACKEND_SUBPICTURE ){ |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
973 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
974 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
|
975 OSD_init(); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
976 if(!subpicture_alloc) |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
977 return;//dimensions still unknown. |
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 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
|
980 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
|
981 subpicture.height); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
982 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
983 if(!have_osd_to_draw) |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
984 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
|
985 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
986 if(osd_has_changed){ |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
987 //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
|
988 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
|
989 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
|
990 } |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
991 XvMCSyncSubpicture(mDisplay,&subpicture);//todo usleeep wait! |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
992 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
993 if(subpicture_mode == BLEND_SUBPICTURE){ |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
994 osd_rndr = find_free_surface(); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
995 if(osd_rndr == NULL) |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
996 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
|
997 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
998 rez = XvMCBlendSubpicture2(mDisplay, |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
999 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
|
1000 &subpicture, |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1001 0, 0, subpicture.width, subpicture.height, |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1002 0, 0, image_width, image_height); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1003 if(rez!=Success){ |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1004 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
|
1005 assert(0); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1006 return; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1007 } |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1008 // 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
|
1009 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1010 //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
|
1011 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
|
1012 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
|
1013 //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
|
1014 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1015 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
|
1016 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
|
1017 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
|
1018 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1019 p_render_surface_to_show = osd_rndr; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1020 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
|
1021 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1022 if(verbose > 3) |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1023 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
|
1024 }//endof if(BLEND) |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1025 if(subpicture_mode == BACKEND_SUBPICTURE){ |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1026 rez = XvMCBlendSubpicture(mDisplay, |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1027 p_render_surface_to_show->p_surface, |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1028 &subpicture, |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1029 0, 0, subpicture.width, subpicture.height, |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1030 0, 0, image_width, image_height); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1031 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1032 } |
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 }//if(BLEND||BACKEND) |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1035 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1036 |
10452 | 1037 static void xvmc_sync_surface(XvMCSurface * srf){ |
1038 int status,rez; | |
1039 rez = XvMCGetSurfaceStatus(mDisplay,srf,&status); | |
1040 assert(rez==Success); | |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1041 if((status & XVMC_RENDERING) == 0) |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1042 return;//surface is already complete |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1043 if(!busy_wait){ |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1044 rez = XvMCFlushSurface(mDisplay, srf); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1045 assert(rez==Success); |
10452 | 1046 |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1047 do{ |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1048 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
|
1049 XvMCGetSurfaceStatus(mDisplay,srf,&status); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1050 } while (status & XVMC_RENDERING); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1051 return;//done |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1052 } |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1053 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1054 XvMCSyncSurface(mDisplay, srf); |
10452 | 1055 } |
1056 | |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1057 static void flip_page(void){ |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1058 int rez; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1059 int clipX,clipY,clipW,clipH; |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1060 int i,cfs; |
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 clipX = drwX-(vo_panscan_x>>1); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1063 clipY = drwY-(vo_panscan_y>>1); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1064 clipW = vo_dwidth+vo_panscan_x; |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1065 clipH = vo_dheight+vo_panscan_y; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1066 |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1067 if( verbose > 3 ) |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1068 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
|
1069 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1070 if(p_render_surface_to_show == NULL) return; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1071 assert( p_render_surface_to_show->magic == MP_XVMC_RENDER_MAGIC ); |
10452 | 1072 //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
|
1073 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1074 if(use_queue){ |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1075 // 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
|
1076 // after that start displaying |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1077 cfs = count_free_surfaces(); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1078 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
|
1079 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
|
1080 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
|
1081 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
|
1082 return; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1083 } |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1084 p_render_surface_to_show=show_queue[0]; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1085 if(verbose > 4) |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1086 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
|
1087 free_element--; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1088 for(i=0; i<free_element; i++){ |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1089 show_queue[i] = show_queue[i+1]; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1090 } |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1091 show_queue[free_element] = NULL; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1092 } |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1093 |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1094 // make sure the rendering is done |
10452 | 1095 xvmc_sync_surface(p_render_surface_to_show->p_surface); |
1096 | |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1097 //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
|
1098 if(p_render_surface_visible != NULL) |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1099 p_render_surface_visible->state &= ~MP_XVMC_STATE_DISPLAY_PENDING; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1100 |
10452 | 1101 //!!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
|
1102 |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1103 //show it, displaying is always vsynced, so skip it for benchmark |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1104 if(!benchmark){ |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1105 rez = XvMCPutSurface(mDisplay, p_render_surface_to_show->p_surface, |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1106 vo_window, |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1107 0, 0, image_width, image_height, |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1108 clipX, clipY, clipW, clipH, |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1109 3);//p_render_surface_to_show->display_flags); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1110 if(rez != Success){ |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1111 printf("vo_xvmc: PutSurface failer, critical error!\n"); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1112 assert(0); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1113 } |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1114 } |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1115 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1116 p_render_surface_visible = p_render_surface_to_show; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1117 p_render_surface_to_show = NULL; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1118 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1119 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1120 static void check_events(void){ |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1121 int dwidth,dheight; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1122 Window mRoot; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1123 uint32_t drwBorderWidth,drwDepth; |
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 int e=vo_x11_check_events(mDisplay); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1126 if(e&VO_EVENT_RESIZE) |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1127 { |
10497
9e6becbd5c8a
draw rectangle with color key, avoid blue bars. avoid PutSurface before 1'st image
iive
parents:
10452
diff
changeset
|
1128 e |= VO_EVENT_EXPOSE; |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1129 |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1130 XGetGeometry( mDisplay,vo_window,&mRoot,&drwX,&drwY,&vo_dwidth,&vo_dheight, |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1131 &drwBorderWidth,&drwDepth ); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1132 drwX = drwY = 0; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1133 mp_msg(MSGT_VO,MSGL_V, "[xvmc] dx: %d dy: %d dw: %d dh: %d\n",drwX,drwY, |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1134 vo_dwidth,vo_dheight ); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1135 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1136 aspect(&dwidth,&dheight,A_NOZOOM); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1137 if ( vo_fs ) |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1138 { |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1139 aspect(&dwidth,&dheight,A_ZOOM); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1140 drwX=( vo_screenwidth - (dwidth > vo_screenwidth?vo_screenwidth:dwidth) ) / 2; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1141 drwY=( vo_screenheight - (dheight > vo_screenheight?vo_screenheight:dheight) ) / 2; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1142 vo_dwidth=(dwidth > vo_screenwidth?vo_screenwidth:dwidth); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1143 vo_dheight=(dheight > vo_screenheight?vo_screenheight:dheight); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1144 mp_msg(MSGT_VO,MSGL_V, "[xvmc-fs] dx: %d dy: %d dw: %d dh: %d\n",drwX,drwY,vo_dwidth,vo_dheight ); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1145 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1146 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1147 if ( e & VO_EVENT_EXPOSE ) |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1148 { |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1149 mDrawColorKey(drwX,drwY,vo_dwidth,vo_dheight); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1150 if(p_render_surface_visible != NULL) |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1151 XvMCPutSurface(mDisplay, p_render_surface_visible->p_surface,vo_window, |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1152 0, 0, image_width, image_height, |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1153 drwX,drwY,vo_dwidth,vo_dheight, |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1154 3);//,p_render_surface_visible->display_flags);!! |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1155 } |
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 static void xvmc_free(void){ |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1159 int i; |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1160 if( subpicture_alloc ){ |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1161 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1162 XvMCDestroySubpicture(mDisplay,&subpicture); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1163 deallocate_xvimage(); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1164 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1165 subpicture_alloc = 0; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1166 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1167 if(verbose > 3) |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1168 printf("vo_xvmc: subpicture destroyed\n"); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1169 } |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1170 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1171 if( number_of_surfaces ){ |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1172 |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1173 XvMCDestroyMacroBlocks(mDisplay,&mv_blocks); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1174 XvMCDestroyBlocks(mDisplay,&data_blocks); |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1175 |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1176 for(i=0; i<number_of_surfaces; i++) |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1177 { |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1178 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
|
1179 XvMCDestroySurface(mDisplay,&surface_array[i]); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1180 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1181 if( (surface_render[i].state != 0) && |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1182 (p_render_surface_visible != &surface_render[i]) ) |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1183 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
|
1184 surface_render[i].state); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1185 } |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1186 |
11415 | 1187 memset(surface_render,0,MAX_SURFACES*sizeof(xvmc_render_state_t));//for debuging |
10452 | 1188 free(surface_render);surface_render=NULL; |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1189 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1190 XvMCDestroyContext(mDisplay,&ctx); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1191 number_of_surfaces = 0; |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1192 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1193 if(verbose > 3) printf("vo_xvmc: Context sucessfuly freed\n"); |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1194 } |
10698
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 |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1197 if( xv_port !=0 ){ |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1198 XvUngrabPort(mDisplay,xv_port,CurrentTime); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1199 xv_port = 0; |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1200 if(verbose > 3) printf("vo_xvmc: xv_port sucessfuly ungrabed\n"); |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1201 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1202 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1203 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1204 static void uninit(void){ |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1205 if( verbose > 3 ) printf("vo_xvmc: uninit called\n"); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1206 xvmc_free(); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1207 //from vo_xv |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1208 vo_vm_close(mDisplay); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1209 vo_x11_uninit(); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1210 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1211 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1212 static uint32_t query_format(uint32_t format){ |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1213 uint32_t flags; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1214 XvMCSurfaceInfo qsurface_info; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1215 int mode_id; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1216 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1217 if(verbose > 3) |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1218 printf("vo_xvmc: query_format=%X\n",format); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1219 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1220 if(!IMGFMT_IS_XVMC(format)) return 0;// no caps supported |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1221 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
|
1222 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1223 if( mode_id == 0 ) return 0; |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1224 |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1225 flags = VFCAP_CSP_SUPPORTED | |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1226 VFCAP_CSP_SUPPORTED_BY_HW | |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1227 VFCAP_ACCEPT_STRIDE; |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1228 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1229 if( (qsurface_info.subpicture_max_width != 0) && |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1230 (qsurface_info.subpicture_max_height != 0) ) |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1231 flags|=VFCAP_OSD; |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1232 return flags; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1233 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1234 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1235 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1236 static uint32_t draw_slice(uint8_t *image[], int stride[], |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1237 int w, int h, int x, int y){ |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1238 xvmc_render_state_t * rndr; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1239 int rez; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1240 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1241 if(verbose > 3) |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1242 printf("vo_xvmc: draw_slice y=%d\n",y); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1243 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1244 rndr = (xvmc_render_state_t*)image[2];//this is copy of priv-ate |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1245 assert( rndr != NULL ); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1246 assert( rndr->magic == MP_XVMC_RENDER_MAGIC ); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1247 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1248 rez = XvMCRenderSurface(mDisplay,&ctx,rndr->picture_structure, |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1249 rndr->p_surface, |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1250 rndr->p_past_surface, |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1251 rndr->p_future_surface, |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1252 rndr->flags, |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1253 rndr->filled_mv_blocks_num,rndr->start_mv_blocks_num, |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1254 &mv_blocks,&data_blocks); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1255 #if 1 |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1256 if(rez != Success) |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1257 { |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1258 int i; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1259 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
|
1260 |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1261 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
|
1262 rndr->picture_structure,rndr->flags,rndr->start_mv_blocks_num, |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1263 rndr->filled_mv_blocks_num); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1264 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
|
1265 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
|
1266 |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1267 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
|
1268 XvMCMacroBlock* testblock; |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1269 testblock = &mv_blocks.macro_blocks[i]; |
10360
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 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
|
1272 testblock->x,testblock->y,testblock->macroblock_type, |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1273 testblock->motion_type,testblock->motion_vertical_field_select); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1274 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
|
1275 testblock->dct_type,testblock->index,testblock->coded_block_pattern, |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1276 testblock->pad0); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1277 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
|
1278 testblock->PMV[0][0][0],testblock->PMV[0][0][1]); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1279 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1280 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1281 #endif |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1282 assert(rez==Success); |
10452 | 1283 if(verbose > 3 ) printf("vo_xvmc: flush surface\n"); |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1284 rez = XvMCFlushSurface(mDisplay, rndr->p_surface); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1285 assert(rez==Success); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1286 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1287 // rndr->start_mv_blocks_num += rndr->filled_mv_blocks_num; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1288 rndr->start_mv_blocks_num = 0; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1289 rndr->filled_mv_blocks_num = 0; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1290 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1291 rndr->next_free_data_block_num = 0; |
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 return VO_TRUE; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1294 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1295 |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1296 //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
|
1297 //check if the surface is not still displaying |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1298 static void check_osd_source(xvmc_render_state_t * src_rndr){ |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1299 xvmc_render_state_t * osd_rndr; |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1300 int stat; |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1301 //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
|
1302 if(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
|
1303 if(verbose > 3) |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1304 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
|
1305 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
|
1306 XvMCGetSurfaceStatus(mDisplay, osd_rndr->p_surface, &stat); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1307 if(!(stat & XVMC_RENDERING)) |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1308 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
|
1309 } |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1310 } |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1311 static int count_free_surfaces(){ |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1312 int i,num; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1313 num=0; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1314 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
|
1315 check_osd_source(&surface_render[i]); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1316 if(surface_render[i].state == 0) |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1317 num++; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1318 } |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1319 return num; |
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 |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1322 static xvmc_render_state_t * find_free_surface(){ |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1323 int i,t; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1324 int stat; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1325 xvmc_render_state_t * visible_rndr; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1326 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1327 visible_rndr = NULL; |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1328 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
|
1329 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1330 check_osd_source(&surface_render[i]); |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1331 if( surface_render[i].state == 0){ |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1332 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
|
1333 if( (stat & XVMC_DISPLAYING) == 0 ) |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1334 return &surface_render[i]; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1335 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
|
1336 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1337 } |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1338 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1339 //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
|
1340 //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
|
1341 if(visible_rndr != NULL){ |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1342 printf("vo_xvmc: waiting retrace\n"); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1343 for(t=0;t<1000;t++){ |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1344 usec_sleep(1000);//1ms |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1345 XvMCGetSurfaceStatus(mDisplay, visible_rndr->p_surface,&stat); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1346 if( (stat & XVMC_DISPLAYING) == 0 ) |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1347 return visible_rndr; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1348 } |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1349 } |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1350 //todo remove when stable |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1351 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
|
1352 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
|
1353 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
|
1354 return NULL; |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1355 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1356 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1357 static uint32_t get_image(mp_image_t *mpi){ |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1358 xvmc_render_state_t * rndr; |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1359 |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1360 rndr = find_free_surface(); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1361 |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1362 if(rndr == NULL){ |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1363 printf("vo_xvmc: get_image failed\n"); |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1364 return VO_FALSE; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1365 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1366 |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1367 assert(rndr->start_mv_blocks_num == 0); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1368 assert(rndr->filled_mv_blocks_num == 0); |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1369 assert(rndr->next_free_data_block_num == 0); |
10452 | 1370 |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1371 mpi->flags |= MP_IMGFLAG_DIRECT; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1372 //keep strides 0 to avoid field manipulations |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1373 mpi->stride[0] = 0; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1374 mpi->stride[1] = 0; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1375 mpi->stride[2] = 0; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1376 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1377 // these are shared!! so watch out |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1378 // do call RenderSurface before overwriting |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1379 mpi->planes[0] = (char*)data_blocks.blocks; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1380 mpi->planes[1] = (char*)mv_blocks.macro_blocks; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1381 mpi->priv = |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1382 mpi->planes[2] = (char*)rndr; |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1383 |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1384 rndr->picture_structure = 0; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1385 rndr->flags = 0; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1386 rndr->state = 0; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1387 rndr->start_mv_blocks_num = 0; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1388 rndr->filled_mv_blocks_num = 0; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1389 rndr->next_free_data_block_num = 0; |
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1390 |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1391 if( verbose > 3 ) |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1392 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
|
1393 rndr,rndr->p_surface); |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1394 return VO_TRUE; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1395 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1396 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1397 static uint32_t control(uint32_t request, void *data, ... ) |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1398 { |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1399 switch (request){ |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1400 case VOCTRL_QUERY_FORMAT: |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1401 return query_format(*((uint32_t*)data)); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1402 case VOCTRL_DRAW_IMAGE: |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1403 return xvmc_draw_image((mp_image_t *)data); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1404 case VOCTRL_GET_IMAGE: |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1405 return get_image((mp_image_t *)data); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1406 //vo_xv |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1407 case VOCTRL_GUISUPPORT: |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1408 return VO_TRUE; |
11542 | 1409 case VOCTRL_ONTOP: |
1410 vo_x11_ontop(); | |
1411 return VO_TRUE; | |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1412 case VOCTRL_FULLSCREEN: |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1413 vo_x11_fullscreen(); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1414 case VOCTRL_GET_PANSCAN: |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1415 if ( !vo_config_count || !vo_fs ) return VO_FALSE; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1416 return VO_TRUE; |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1417 // indended, fallthrough to update panscan on fullscreen/windowed switch |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1418 case VOCTRL_SET_PANSCAN: |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1419 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
|
1420 { |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1421 int old_y = vo_panscan_y; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1422 panscan_calc(); |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1423 |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1424 if(old_y != vo_panscan_y) |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1425 { |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1426 XClearWindow(mDisplay, vo_window); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1427 XFlush(mDisplay); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1428 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1429 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1430 return VO_TRUE; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1431 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1432 case VOCTRL_SET_EQUALIZER: |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1433 { |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1434 va_list ap; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1435 int value; |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1436 |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1437 va_start(ap, data); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1438 value = va_arg(ap, int); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1439 va_end(ap); |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1440 |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1441 return(vo_xv_set_eq(xv_port, data, value)); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1442 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1443 |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1444 case VOCTRL_GET_EQUALIZER: |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1445 { |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1446 va_list ap; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1447 int *value; |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1448 |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1449 va_start(ap, data); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1450 value = va_arg(ap, int*); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1451 va_end(ap); |
10698
7ab88b24cb81
OSD support, optinal queue, optional use of sleep(), and benchmark mode
iive
parents:
10608
diff
changeset
|
1452 |
10360
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1453 return(vo_xv_get_eq(xv_port, data, value)); |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1454 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1455 } |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1456 return VO_NOTIMPL; |
b79a4c15d081
Initial version of XVideo Motion Compensation video driver/render
iive
parents:
diff
changeset
|
1457 } |