Imported Upstream version 1.15.1
[deb_xorg-server.git] / hw / xwin / winvideo.c
1 /*
2 *Copyright (C) 2003-2004 Harold L Hunt II All Rights Reserved.
3 *
4 *Permission is hereby granted, free of charge, to any person obtaining
5 * a copy of this software and associated documentation files (the
6 *"Software"), to deal in the Software without restriction, including
7 *without limitation the rights to use, copy, modify, merge, publish,
8 *distribute, sublicense, and/or sell copies of the Software, and to
9 *permit persons to whom the Software is furnished to do so, subject to
10 *the following conditions:
11 *
12 *The above copyright notice and this permission notice shall be
13 *included in all copies or substantial portions of the Software.
14 *
15 *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 *NONINFRINGEMENT. IN NO EVENT SHALL HAROLD L HUNT II BE LIABLE FOR
19 *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
20 *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21 *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 *
23 *Except as contained in this notice, the name of Harold L Hunt II
24 *shall not be used in advertising or otherwise to promote the sale, use
25 *or other dealings in this Software without prior written authorization
26 *from Harold L Hunt II.
27 *
28 * Authors: Harold L Hunt II
29 */
30
31 #ifdef HAVE_XWIN_CONFIG_H
32 #include <xwin-config.h>
33 #endif
34 #include "win.h"
35 #include <X11/extensions/Xv.h>
36 #include <X11/extensions/Xvproto.h>
37
38 void
39 winInitVideo(ScreenPtr pScreen);
40
41 /*
42 * winInitVideo - Initialize support for the X Video (Xv) Extension.
43 */
44
45 void
46 winInitVideo(ScreenPtr pScreen)
47 {
48 winScreenPriv(pScreen);
49 winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
50
51 if (pScreenInfo->dwBPP > 8) {
52
53 }
54
55 }
56
57 #if 0
58 #include "../xfree86/common/xf86.h"
59 #include "../Xext/xvdix.h"
60 #include "../xfree86/common/xf86xv.h"
61 #include <X11/extensions/Xv.h>
62 #endif
63
64 #if 0
65 /* client libraries expect an encoding */
66 static XF86VideoEncodingRec DummyEncoding[1] = {
67 {
68 0,
69 "XV_IMAGE",
70 IMAGE_MAX_WIDTH, IMAGE_MAX_HEIGHT,
71 {1, 1}
72 }
73 };
74
75 #define NUM_FORMATS 3
76
77 static XF86VideoFormatRec Formats[NUM_FORMATS] = {
78 {15, TrueColor}, {16, TrueColor}, {24, TrueColor}
79 };
80
81 #define NUM_ATTRIBUTES 3
82
83 static XF86AttributeRec Attributes[NUM_ATTRIBUTES] = {
84 {XvSettable | XvGettable, 0, (1 << 24) - 1, "XV_COLORKEY"},
85 {XvSettable | XvGettable, -128, 127, "XV_BRIGHTNESS"},
86 {XvSettable | XvGettable, 0, 255, "XV_CONTRAST"}
87 };
88
89 #define NUM_IMAGES 4
90
91 static XF86ImageRec Images[NUM_IMAGES] = {
92 XVIMAGE_YUY2,
93 XVIMAGE_YV12,
94 XVIMAGE_I420,
95 XVIMAGE_UYVY
96 };
97
98 /*
99 * winInitVideo - Initialize support for the X Video (Xv) Extension.
100 */
101
102 void
103 winInitVideo(ScreenPtr pScreen)
104 {
105 winScreenPriv(pScreen);
106 winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
107 XF86VideoAdaptorPtr newAdaptor = NULL;
108
109 if (pScreenInfo->dwBPP > 8) {
110 newAdaptor = I810SetupImageVideo(pScreen);
111 I810InitOffscreenImages(pScreen);
112 }
113
114 xf86XVScreenInit(pScreen, adaptors, 1);
115 }
116
117 static XF86VideoAdaptorPtr
118 winSetupImageVideo(ScreenPtr pScreen)
119 {
120 ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
121
122 #if 0
123 I810Ptr pI810 = I810PTR(pScrn);
124 #endif
125 XF86VideoAdaptorPtr adapt;
126
127 if (!(adapt = calloc(1, sizeof(XF86VideoAdaptorRec))))
128 return NULL;
129
130 adapt->type = XvWindowMask | XvInputMask | XvImageMask;
131 adapt->flags = VIDEO_OVERLAID_IMAGES | VIDEO_CLIP_TO_VIEWPORT;
132 adapt->name = PROJECT_NAME " Video Overlay";
133 adapt->nEncodings = 1;
134 adapt->pEncodings = DummyEncoding;
135 adapt->nFormats = NUM_FORMATS;
136 adapt->pFormats = Formats;
137 adapt->nPorts = 1;
138 adapt->pPortPrivates = NULL;
139
140 adapt->pPortPrivates[0].ptr = NULL;
141 adapt->pAttributes = Attributes;
142 adapt->nImages = NUM_IMAGES;
143 adapt->nAttributes = NUM_ATTRIBUTES;
144 adapt->pImages = Images;
145 adapt->PutVideo = NULL;
146 adapt->PutStill = NULL;
147 adapt->GetVideo = NULL;
148 adapt->GetStill = NULL;
149 #if 0
150 adapt->StopVideo = I810StopVideo;
151 adapt->SetPortAttribute = I810SetPortAttribute;
152 adapt->GetPortAttribute = I810GetPortAttribute;
153 adapt->QueryBestSize = I810QueryBestSize;
154 adapt->PutImage = I810PutImage;
155 adapt->QueryImageAttributes = I810QueryImageAttributes;
156 #endif
157
158 #if 0
159 pPriv->colorKey = pI810->colorKey & ((1 << pScrn->depth) - 1);
160 #endif
161 pPriv->videoStatus = 0;
162 pPriv->brightness = 0;
163 pPriv->contrast = 64;
164 pPriv->linear = NULL;
165 pPriv->currentBuf = 0;
166
167 #if 0
168 /* gotta uninit this someplace */
169 RegionNull(&pPriv->clip);
170 #endif
171
172 #if 0
173 pI810->adaptor = adapt;
174
175 pI810->BlockHandler = pScreen->BlockHandler;
176 pScreen->BlockHandler = I810BlockHandler;
177 #endif
178
179 #if 0
180 xvBrightness = MAKE_ATOM("XV_BRIGHTNESS");
181 xvContrast = MAKE_ATOM("XV_CONTRAST");
182 xvColorKey = MAKE_ATOM("XV_COLORKEY");
183 #endif
184
185 #if 0
186 I810ResetVideo(pScrn);
187 #endif
188
189 return adapt;
190 }
191 #endif