2 *Copyright (C) 2003-2004 Harold L Hunt II All Rights Reserved.
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:
12 *The above copyright notice and this permission notice shall be
13 *included in all copies or substantial portions of the Software.
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.
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.
28 * Authors: Harold L Hunt II
31 #ifdef HAVE_XWIN_CONFIG_H
32 #include <xwin-config.h>
35 #include <X11/extensions/Xv.h>
36 #include <X11/extensions/Xvproto.h>
39 winInitVideo(ScreenPtr pScreen
);
42 * winInitVideo - Initialize support for the X Video (Xv) Extension.
46 winInitVideo(ScreenPtr pScreen
)
48 winScreenPriv(pScreen
);
49 winScreenInfo
*pScreenInfo
= pScreenPriv
->pScreenInfo
;
51 if (pScreenInfo
->dwBPP
> 8) {
58 #include "../xfree86/common/xf86.h"
59 #include "../Xext/xvdix.h"
60 #include "../xfree86/common/xf86xv.h"
61 #include <X11/extensions/Xv.h>
65 /* client libraries expect an encoding */
66 static XF86VideoEncodingRec DummyEncoding
[1] = {
70 IMAGE_MAX_WIDTH
, IMAGE_MAX_HEIGHT
,
77 static XF86VideoFormatRec Formats
[NUM_FORMATS
] = {
78 {15, TrueColor
}, {16, TrueColor
}, {24, TrueColor
}
81 #define NUM_ATTRIBUTES 3
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"}
91 static XF86ImageRec Images
[NUM_IMAGES
] = {
99 * winInitVideo - Initialize support for the X Video (Xv) Extension.
103 winInitVideo(ScreenPtr pScreen
)
105 winScreenPriv(pScreen
);
106 winScreenInfo
*pScreenInfo
= pScreenPriv
->pScreenInfo
;
107 XF86VideoAdaptorPtr newAdaptor
= NULL
;
109 if (pScreenInfo
->dwBPP
> 8) {
110 newAdaptor
= I810SetupImageVideo(pScreen
);
111 I810InitOffscreenImages(pScreen
);
114 xf86XVScreenInit(pScreen
, adaptors
, 1);
117 static XF86VideoAdaptorPtr
118 winSetupImageVideo(ScreenPtr pScreen
)
120 ScrnInfoPtr pScrn
= xf86Screens
[pScreen
->myNum
];
123 I810Ptr pI810
= I810PTR(pScrn
);
125 XF86VideoAdaptorPtr adapt
;
127 if (!(adapt
= calloc(1, sizeof(XF86VideoAdaptorRec
))))
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
;
138 adapt
->pPortPrivates
= NULL
;
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
;
150 adapt
->StopVideo
= I810StopVideo
;
151 adapt
->SetPortAttribute
= I810SetPortAttribute
;
152 adapt
->GetPortAttribute
= I810GetPortAttribute
;
153 adapt
->QueryBestSize
= I810QueryBestSize
;
154 adapt
->PutImage
= I810PutImage
;
155 adapt
->QueryImageAttributes
= I810QueryImageAttributes
;
159 pPriv
->colorKey
= pI810
->colorKey
& ((1 << pScrn
->depth
) - 1);
161 pPriv
->videoStatus
= 0;
162 pPriv
->brightness
= 0;
163 pPriv
->contrast
= 64;
164 pPriv
->linear
= NULL
;
165 pPriv
->currentBuf
= 0;
168 /* gotta uninit this someplace */
169 RegionNull(&pPriv
->clip
);
173 pI810
->adaptor
= adapt
;
175 pI810
->BlockHandler
= pScreen
->BlockHandler
;
176 pScreen
->BlockHandler
= I810BlockHandler
;
180 xvBrightness
= MAKE_ATOM("XV_BRIGHTNESS");
181 xvContrast
= MAKE_ATOM("XV_CONTRAST");
182 xvColorKey
= MAKE_ATOM("XV_COLORKEY");
186 I810ResetVideo(pScrn
);