annotate libvo/vo_xvmc.c @ 27025:e598c9756181

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