1 /**************************************************************************
5 Copyright (c) 2013 Samsung Electronics Co., Ltd All Rights Reserved
7 Contact: Boram Park <boram1288.park@samsung.com>
8 Sangjin LEE <lsj119@samsung.com>
10 Permission is hereby granted, free of charge, to any person obtaining a
11 copy of this software and associated documentation files (the
12 "Software"), to deal in the Software without restriction, including
13 without limitation the rights to use, copy, modify, merge, publish,
14 distribute, sub license, and/or sell copies of the Software, and to
15 permit persons to whom the Software is furnished to do so, subject to
16 the following conditions:
18 The above copyright notice and this permission notice (including the
19 next paragraph) shall be included in all copies or substantial portions
22 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
23 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
25 IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
26 ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
27 TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
28 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30 **************************************************************************/
39 #include <sys/types.h>
40 #include <sys/fcntl.h>
51 #include <X11/Xatom.h>
53 #include <windowstr.h>
55 #include <X11/extensions/Xvlib.h>
56 #include <X11/extensions/Xv.h>
57 #include <X11/extensions/Xvproto.h>
59 #include "xdbg_types.h"
60 #include "xdbg_evlog_xv.h"
63 _EvlogRequestXv(xReq *req, char *reply, int *len)
71 xvGrabPortReq *stuff = (xvGrabPortReq *)req;
72 REPLY (": XID(0x%lx)",
80 xvUngrabPortReq *stuff = (xvUngrabPortReq *)req;
81 REPLY (": XID(0x%lx)",
89 xvGetStillReq *stuff = (xvGetStillReq *)req;
90 REPLY (": XID(0x%lx) Drawable(0x%lx) GC(0x%lx) Vid(%d,%d) Drw(%d,%d)",
104 xvStopVideoReq *stuff = (xvStopVideoReq *)req;
105 REPLY (": XID(0x%lx) Drawable(0x%lx)",
112 case xv_SelectVideoNotify:
114 xvSelectVideoNotifyReq *stuff = (xvSelectVideoNotifyReq *)req;
115 REPLY (": XID(0x%lx) On/Off(%d)",
122 case xv_SelectPortNotify:
124 xvSelectPortNotifyReq *stuff = (xvSelectPortNotifyReq *)req;
125 REPLY (": XID(0x%lx) On/Off(%d)",
132 case xv_QueryBestSize:
134 xvQueryBestSizeReq *stuff = (xvQueryBestSizeReq *)req;
135 REPLY (": XID(0x%lx) VidSize(%dx%d) DrwSize(%dx%d)",
145 case xv_SetPortAttribute:
147 xvSetPortAttributeReq *stuff = (xvSetPortAttributeReq *)req;
148 REPLY (": XID(0x%lx) Attribute(0x%lx) value(0x%lx)",
158 xvPutImageReq *stuff = (xvPutImageReq *)req;
159 REPLY (": XID(0x%lx) Drawable(0x%lx) GC(0x%lx) ID(0x%lx) src(%d,%d) drw(%d,%d)",
174 xvShmPutImageReq *stuff = (xvShmPutImageReq *)req;
175 REPLY (": XID(0x%lx) Drawable(0x%lx) GC(0x%lx) ID(0x%lx) src(%d,%d) drw(%d,%d)",
196 _EvlogEventXv (xEvent *evt, int first_base, char *reply, int *len)
200 switch ((stuff->u.u.type & 0x7F) - first_base)
204 XvVideoNotifyEvent *stuff = (XvVideoNotifyEvent *) evt;
205 REPLY (": XID(0x%lx) reason(%ld) portID(0x%lx)",
215 XvPortNotifyEvent *stuff = (XvPortNotifyEvent *) evt;
216 REPLY (": XID(0x%lx) Attribute(%lx) Value(%ld)",
232 xDbgEvlogXvGetBase (void *dpy, ExtensionInfo *extinfo)
235 Display *d = (Display*)dpy;
237 RETURN_IF_FAIL (d != NULL);
238 RETURN_IF_FAIL (extinfo != NULL);
240 if (!XQueryExtension(d, XvName, &extinfo->opcode, &extinfo->evt_base, &extinfo->err_base))
242 fprintf (stderr, "[UTILX] no Xv extension. \n");
245 extinfo->req_func = _EvlogRequestXv;
246 extinfo->evt_func = _EvlogEventXv;
248 ExtensionEntry *xext = CheckExtension (XvName);
249 RETURN_IF_FAIL (xext != NULL);
251 extinfo->opcode = xext->base;
252 extinfo->evt_base = xext->eventBase;
253 extinfo->err_base = xext->errorBase;
254 extinfo->req_func = _EvlogRequestXv;
255 extinfo->evt_func = _EvlogEventXv;