1706f2543Smrg/*
2706f2543Smrg *Copyright (C) 2003-2004 Harold L Hunt II All Rights Reserved.
3706f2543Smrg *
4706f2543Smrg *Permission is hereby granted, free of charge, to any person obtaining
5706f2543Smrg * a copy of this software and associated documentation files (the
6706f2543Smrg *"Software"), to deal in the Software without restriction, including
7706f2543Smrg *without limitation the rights to use, copy, modify, merge, publish,
8706f2543Smrg *distribute, sublicense, and/or sell copies of the Software, and to
9706f2543Smrg *permit persons to whom the Software is furnished to do so, subject to
10706f2543Smrg *the following conditions:
11706f2543Smrg *
12706f2543Smrg *The above copyright notice and this permission notice shall be
13706f2543Smrg *included in all copies or substantial portions of the Software.
14706f2543Smrg *
15706f2543Smrg *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16706f2543Smrg *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17706f2543Smrg *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18706f2543Smrg *NONINFRINGEMENT. IN NO EVENT SHALL HAROLD L HUNT II BE LIABLE FOR
19706f2543Smrg *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
20706f2543Smrg *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21706f2543Smrg *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22706f2543Smrg *
23706f2543Smrg *Except as contained in this notice, the name of Harold L Hunt II
24706f2543Smrg *shall not be used in advertising or otherwise to promote the sale, use
25706f2543Smrg *or other dealings in this Software without prior written authorization
26706f2543Smrg *from Harold L Hunt II.
27706f2543Smrg *
28706f2543Smrg * Authors:	Harold L Hunt II
29706f2543Smrg */
30706f2543Smrg
31706f2543Smrg#ifdef HAVE_XWIN_CONFIG_H
32706f2543Smrg#include <xwin-config.h>
33706f2543Smrg#endif
34706f2543Smrg#include "win.h"
35706f2543Smrg#include <X11/extensions/Xv.h>
36706f2543Smrg#include <X11/extensions/Xvproto.h>
37706f2543Smrg
38706f2543Smrgvoid
39706f2543SmrgwinInitVideo (ScreenPtr pScreen);
40706f2543Smrg
41706f2543Smrg/*
42706f2543Smrg * winInitVideo - Initialize support for the X Video (Xv) Extension.
43706f2543Smrg */
44706f2543Smrg
45706f2543Smrgvoid
46706f2543SmrgwinInitVideo (ScreenPtr pScreen)
47706f2543Smrg{
48706f2543Smrg  winScreenPriv(pScreen);
49706f2543Smrg  winScreenInfo		*pScreenInfo = pScreenPriv->pScreenInfo;
50706f2543Smrg
51706f2543Smrg  if (pScreenInfo->dwBPP > 8)
52706f2543Smrg    {
53706f2543Smrg
54706f2543Smrg    }
55706f2543Smrg
56706f2543Smrg
57706f2543Smrg}
58706f2543Smrg
59706f2543Smrg
60706f2543Smrg
61706f2543Smrg
62706f2543Smrg
63706f2543Smrg
64706f2543Smrg
65706f2543Smrg#if 0
66706f2543Smrg#include "../xfree86/common/xf86.h"
67706f2543Smrg#include "../Xext/xvdix.h"
68706f2543Smrg#include "../xfree86/common/xf86xv.h"
69706f2543Smrg#include <X11/extensions/Xv.h>
70706f2543Smrg#endif
71706f2543Smrg
72706f2543Smrg#include "win.h"
73706f2543Smrg
74706f2543Smrg
75706f2543Smrg
76706f2543Smrg#if 0
77706f2543Smrg/* client libraries expect an encoding */
78706f2543Smrgstatic XF86VideoEncodingRec DummyEncoding[1] =
79706f2543Smrg{
80706f2543Smrg {
81706f2543Smrg   0,
82706f2543Smrg   "XV_IMAGE",
83706f2543Smrg   IMAGE_MAX_WIDTH, IMAGE_MAX_HEIGHT,
84706f2543Smrg   {1, 1}
85706f2543Smrg }
86706f2543Smrg};
87706f2543Smrg
88706f2543Smrg#define NUM_FORMATS 3
89706f2543Smrg
90706f2543Smrgstatic XF86VideoFormatRec Formats[NUM_FORMATS] =
91706f2543Smrg{
92706f2543Smrg  {15, TrueColor}, {16, TrueColor}, {24, TrueColor}
93706f2543Smrg};
94706f2543Smrg
95706f2543Smrg#define NUM_ATTRIBUTES 3
96706f2543Smrg
97706f2543Smrgstatic XF86AttributeRec Attributes[NUM_ATTRIBUTES] =
98706f2543Smrg{
99706f2543Smrg   {XvSettable | XvGettable, 0, (1 << 24) - 1, "XV_COLORKEY"},
100706f2543Smrg   {XvSettable | XvGettable, -128, 127, "XV_BRIGHTNESS"},
101706f2543Smrg   {XvSettable | XvGettable, 0, 255, "XV_CONTRAST"}
102706f2543Smrg};
103706f2543Smrg
104706f2543Smrg#define NUM_IMAGES 4
105706f2543Smrg
106706f2543Smrgstatic XF86ImageRec Images[NUM_IMAGES] =
107706f2543Smrg{
108706f2543Smrg	XVIMAGE_YUY2,
109706f2543Smrg	XVIMAGE_YV12,
110706f2543Smrg	XVIMAGE_I420,
111706f2543Smrg	XVIMAGE_UYVY
112706f2543Smrg};
113706f2543Smrg
114706f2543Smrg
115706f2543Smrg
116706f2543Smrg/*
117706f2543Smrg * winInitVideo - Initialize support for the X Video (Xv) Extension.
118706f2543Smrg */
119706f2543Smrg
120706f2543Smrgvoid
121706f2543SmrgwinInitVideo (ScreenPtr pScreen)
122706f2543Smrg{
123706f2543Smrg  winScreenPriv(pScreen);
124706f2543Smrg  winScreenInfo		*pScreenInfo = pScreenPriv->pScreenInfo;
125706f2543Smrg  XF86VideoAdaptorPtr	newAdaptor = NULL;
126706f2543Smrg
127706f2543Smrg  if (pScreenInfo->dwBPP > 8)
128706f2543Smrg    {
129706f2543Smrg      newAdaptor = I810SetupImageVideo (pScreen);
130706f2543Smrg      I810InitOffscreenImages (pScreen);
131706f2543Smrg    }
132706f2543Smrg
133706f2543Smrg    xf86XVScreenInit (pScreen, adaptors, 1);
134706f2543Smrg}
135706f2543Smrg
136706f2543Smrg
137706f2543Smrgstatic XF86VideoAdaptorPtr
138706f2543SmrgwinSetupImageVideo (ScreenPtr pScreen)
139706f2543Smrg{
140706f2543Smrg    ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
141706f2543Smrg#if 0
142706f2543Smrg    I810Ptr pI810 = I810PTR(pScrn);
143706f2543Smrg#endif
144706f2543Smrg    XF86VideoAdaptorPtr adapt;
145706f2543Smrg
146706f2543Smrg    if (!(adapt = calloc(1, sizeof(XF86VideoAdaptorRec))))
147706f2543Smrg      return NULL;
148706f2543Smrg
149706f2543Smrg    adapt->type = XvWindowMask | XvInputMask | XvImageMask;
150706f2543Smrg    adapt->flags = VIDEO_OVERLAID_IMAGES | VIDEO_CLIP_TO_VIEWPORT;
151706f2543Smrg    adapt->name = PROJECT_NAME " Video Overlay";
152706f2543Smrg    adapt->nEncodings = 1;
153706f2543Smrg    adapt->pEncodings = DummyEncoding;
154706f2543Smrg    adapt->nFormats = NUM_FORMATS;
155706f2543Smrg    adapt->pFormats = Formats;
156706f2543Smrg    adapt->nPorts = 1;
157706f2543Smrg    adapt->pPortPrivates = NULL;
158706f2543Smrg
159706f2543Smrg    adapt->pPortPrivates[0].ptr = NULL;
160706f2543Smrg    adapt->pAttributes = Attributes;
161706f2543Smrg    adapt->nImages = NUM_IMAGES;
162706f2543Smrg    adapt->nAttributes = NUM_ATTRIBUTES;
163706f2543Smrg    adapt->pImages = Images;
164706f2543Smrg    adapt->PutVideo = NULL;
165706f2543Smrg    adapt->PutStill = NULL;
166706f2543Smrg    adapt->GetVideo = NULL;
167706f2543Smrg    adapt->GetStill = NULL;
168706f2543Smrg#if 0
169706f2543Smrg    adapt->StopVideo = I810StopVideo;
170706f2543Smrg    adapt->SetPortAttribute = I810SetPortAttribute;
171706f2543Smrg    adapt->GetPortAttribute = I810GetPortAttribute;
172706f2543Smrg    adapt->QueryBestSize = I810QueryBestSize;
173706f2543Smrg    adapt->PutImage = I810PutImage;
174706f2543Smrg    adapt->QueryImageAttributes = I810QueryImageAttributes;
175706f2543Smrg#endif
176706f2543Smrg
177706f2543Smrg#if 0
178706f2543Smrg    pPriv->colorKey = pI810->colorKey & ((1 << pScrn->depth) - 1);
179706f2543Smrg#endif
180706f2543Smrg    pPriv->videoStatus = 0;
181706f2543Smrg    pPriv->brightness = 0;
182706f2543Smrg    pPriv->contrast = 64;
183706f2543Smrg    pPriv->linear = NULL;
184706f2543Smrg    pPriv->currentBuf = 0;
185706f2543Smrg
186706f2543Smrg#if 0
187706f2543Smrg    /* gotta uninit this someplace */
188706f2543Smrg    RegionNull(&pPriv->clip);
189706f2543Smrg#endif
190706f2543Smrg
191706f2543Smrg#if 0
192706f2543Smrg    pI810->adaptor = adapt;
193706f2543Smrg
194706f2543Smrg    pI810->BlockHandler = pScreen->BlockHandler;
195706f2543Smrg    pScreen->BlockHandler = I810BlockHandler;
196706f2543Smrg#endif
197706f2543Smrg
198706f2543Smrg#if 0
199706f2543Smrg    xvBrightness = MAKE_ATOM("XV_BRIGHTNESS");
200706f2543Smrg    xvContrast   = MAKE_ATOM("XV_CONTRAST");
201706f2543Smrg    xvColorKey   = MAKE_ATOM("XV_COLORKEY");
202706f2543Smrg#endif
203706f2543Smrg
204706f2543Smrg#if 0
205706f2543Smrg    I810ResetVideo(pScrn);
206706f2543Smrg#endif
207706f2543Smrg
208706f2543Smrg    return adapt;
209706f2543Smrg}
210706f2543Smrg#endif
211