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
38void
39winInitVideo (ScreenPtr pScreen);
40
41/*
42 * winInitVideo - Initialize support for the X Video (Xv) Extension.
43 */
44
45void
46winInitVideo (ScreenPtr pScreen)
47{
48  winScreenPriv(pScreen);
49  winScreenInfo		*pScreenInfo = pScreenPriv->pScreenInfo;
50
51  if (pScreenInfo->dwBPP > 8)
52    {
53
54    }
55
56
57}
58
59
60
61
62
63
64
65#if 0
66#include "../xfree86/common/xf86.h"
67#include "../Xext/xvdix.h"
68#include "../xfree86/common/xf86xv.h"
69#include <X11/extensions/Xv.h>
70#endif
71
72#include "win.h"
73
74
75
76#if 0
77/* client libraries expect an encoding */
78static XF86VideoEncodingRec DummyEncoding[1] =
79{
80 {
81   0,
82   "XV_IMAGE",
83   IMAGE_MAX_WIDTH, IMAGE_MAX_HEIGHT,
84   {1, 1}
85 }
86};
87
88#define NUM_FORMATS 3
89
90static XF86VideoFormatRec Formats[NUM_FORMATS] =
91{
92  {15, TrueColor}, {16, TrueColor}, {24, TrueColor}
93};
94
95#define NUM_ATTRIBUTES 3
96
97static XF86AttributeRec Attributes[NUM_ATTRIBUTES] =
98{
99   {XvSettable | XvGettable, 0, (1 << 24) - 1, "XV_COLORKEY"},
100   {XvSettable | XvGettable, -128, 127, "XV_BRIGHTNESS"},
101   {XvSettable | XvGettable, 0, 255, "XV_CONTRAST"}
102};
103
104#define NUM_IMAGES 4
105
106static XF86ImageRec Images[NUM_IMAGES] =
107{
108	XVIMAGE_YUY2,
109	XVIMAGE_YV12,
110	XVIMAGE_I420,
111	XVIMAGE_UYVY
112};
113
114
115
116/*
117 * winInitVideo - Initialize support for the X Video (Xv) Extension.
118 */
119
120void
121winInitVideo (ScreenPtr pScreen)
122{
123  winScreenPriv(pScreen);
124  winScreenInfo		*pScreenInfo = pScreenPriv->pScreenInfo;
125  XF86VideoAdaptorPtr	newAdaptor = NULL;
126
127  if (pScreenInfo->dwBPP > 8)
128    {
129      newAdaptor = I810SetupImageVideo (pScreen);
130      I810InitOffscreenImages (pScreen);
131    }
132
133    xf86XVScreenInit (pScreen, adaptors, 1);
134}
135
136
137static XF86VideoAdaptorPtr
138winSetupImageVideo (ScreenPtr pScreen)
139{
140    ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
141#if 0
142    I810Ptr pI810 = I810PTR(pScrn);
143#endif
144    XF86VideoAdaptorPtr adapt;
145
146    if (!(adapt = calloc(1, sizeof(XF86VideoAdaptorRec))))
147      return NULL;
148
149    adapt->type = XvWindowMask | XvInputMask | XvImageMask;
150    adapt->flags = VIDEO_OVERLAID_IMAGES | VIDEO_CLIP_TO_VIEWPORT;
151    adapt->name = PROJECT_NAME " Video Overlay";
152    adapt->nEncodings = 1;
153    adapt->pEncodings = DummyEncoding;
154    adapt->nFormats = NUM_FORMATS;
155    adapt->pFormats = Formats;
156    adapt->nPorts = 1;
157    adapt->pPortPrivates = NULL;
158
159    adapt->pPortPrivates[0].ptr = NULL;
160    adapt->pAttributes = Attributes;
161    adapt->nImages = NUM_IMAGES;
162    adapt->nAttributes = NUM_ATTRIBUTES;
163    adapt->pImages = Images;
164    adapt->PutVideo = NULL;
165    adapt->PutStill = NULL;
166    adapt->GetVideo = NULL;
167    adapt->GetStill = NULL;
168#if 0
169    adapt->StopVideo = I810StopVideo;
170    adapt->SetPortAttribute = I810SetPortAttribute;
171    adapt->GetPortAttribute = I810GetPortAttribute;
172    adapt->QueryBestSize = I810QueryBestSize;
173    adapt->PutImage = I810PutImage;
174    adapt->QueryImageAttributes = I810QueryImageAttributes;
175#endif
176
177#if 0
178    pPriv->colorKey = pI810->colorKey & ((1 << pScrn->depth) - 1);
179#endif
180    pPriv->videoStatus = 0;
181    pPriv->brightness = 0;
182    pPriv->contrast = 64;
183    pPriv->linear = NULL;
184    pPriv->currentBuf = 0;
185
186#if 0
187    /* gotta uninit this someplace */
188    RegionNull(&pPriv->clip);
189#endif
190
191#if 0
192    pI810->adaptor = adapt;
193
194    pI810->BlockHandler = pScreen->BlockHandler;
195    pScreen->BlockHandler = I810BlockHandler;
196#endif
197
198#if 0
199    xvBrightness = MAKE_ATOM("XV_BRIGHTNESS");
200    xvContrast   = MAKE_ATOM("XV_CONTRAST");
201    xvColorKey   = MAKE_ATOM("XV_COLORKEY");
202#endif
203
204#if 0
205    I810ResetVideo(pScrn);
206#endif
207
208    return adapt;
209}
210#endif
211