summaryrefslogtreecommitdiff
path: root/lib/xvmc/xvmc_unichrome.c
blob: 9738ad3b2df4de6b42988f8af61c8ec2f45885c0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
/*
 * Copyright 2009      Luc Verhaegen.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a
 * copy of this software and associated documentation files (the "Software"),
 * to deal in the Software without restriction, including without limitation
 * the rights to use, copy, modify, merge, publish, distribute, sub license,
 * and/or sell copies of the Software, and to permit persons to whom the
 * Software is furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice (including the
 * next paragraph) shall be included in all copies or substantial portions
 * of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
 * DEALINGS IN THE SOFTWARE.
 */

#include <stdio.h>

#include <X11/Xlibint.h>
#include <X11/extensions/Xv.h>
#include <X11/extensions/Xvlib.h>
#include <X11/extensions/Xvproto.h>
#include <X11/extensions/XvMC.h>
#include <X11/extensions/XvMCproto.h>
#include <X11/extensions/XvMClib.h>
#include <X11/extensions/Xext.h>
#include <X11/extensions/extutil.h>
#include <X11/extensions/vldXvMC.h>

#include "xvmce.h"

/* Oh you must be kidding me. What a bunch of clueless idiots. */
extern Status _xvmc_create_context(Display *dpy, XvMCContext *context,
				   int *priv_count, CARD32 **priv_data);

extern Status _xvmc_destroy_context(Display *dpy, XvMCContext *context);

extern Status _xvmc_create_surface(Display *dpy, XvMCContext *context,
				   XvMCSurface *surface, int *priv_count,
				   CARD32 **priv_data);

extern Status _xvmc_destroy_surface(Display *dpy, XvMCSurface *surface);

extern Status _xvmc_create_subpicture(Display *dpy, XvMCContext *context,
				      XvMCSubpicture *subpicture,
				      int *priv_count, uint **priv_data);

extern Status _xvmc_destroy_subpicture(Display *dpy,
				       XvMCSubpicture *subpicture);


static int XvMC_EventBase;
static int XvMC_ErrorBase;
static int XvMCE_EventBase;
static int XvMCE_ErrorBase;

/*
 *
 */
_X_EXPORT Status
XvMCCreateContext(Display *display, XvPortID port, int surface_type_id,
		  int width, int height, int flags, XvMCContext *context)
{
    Status status;
    int major, minor;
    int priv_count;
    CARD32 *priv_data = NULL;

    printf("%s\n", __func__);

    if (!display || !context)
	return BadValue;

    /* First, check XvMC. */
    if (!XvMCQueryExtension(display, &XvMC_EventBase, &XvMC_ErrorBase)) {
	printf("%s: XvMC extension is missing.\n", __func__);
	return BadRequest;
    }

    status = XvMCQueryVersion(display, &major, &minor);
    if (status != Success) {
	printf("%s: XvMCQueryVersion failed: %d\n", __func__, status);
	return BadImplementation;
    }
    printf("Found XvMC Extension version %d.%d.\n", major, minor);

    /* Now, check our own extension */
    status = XvMCEQueryExtension(display, &major, &minor,
				 &XvMCE_EventBase, &XvMCE_ErrorBase);
    if (status != Success) {
	printf("%s: XvMCEQueryExtension failed: %d\n", __func__, status);
	return status;
    }
    printf("Found Unichrome XvMCE Extension version %d.%d.\n", major, minor);

    /* Only now, we can go and try to create a context, with a twist. */
    context->surface_type_id = surface_type_id;
    context->width = width; /* this better be correct, or we die */
    context->height = height;
    context->flags = flags;
    context->port = port;

    /* now call the old, raped X extension hooks */
    status =_xvmc_create_context(display, context, &priv_count, &priv_data);
    if (status != Success) {
	printf("%s: _xvmc_create_context failed: %d\n", __func__, status);
	return status;
    }

    return BadImplementation;
}


/*
 *
 */
_X_EXPORT Status
XvMCDestroyContext(Display *display, XvMCContext *context)
{
    printf("%s\n", __func__);

    if (!display || !context)
	return BadValue;

    return Success;
}


/*
 *
 */
_X_EXPORT Status
XvMCCreateSurface(Display *display, XvMCContext *context, XvMCSurface *surface)
{
    printf("%s\n", __func__);

    return BadImplementation;
}


/*
 *
 */
_X_EXPORT Status
XvMCDestroySurface(Display *display, XvMCSurface *surface)
{
    printf("%s\n", __func__);

    return Success;
}

/*
 *
 */
_X_EXPORT Status
XvMCPutSurface(Display *display, XvMCSurface *surface, Drawable draw,
	       short src_x, short src_y, unsigned short src_w,
	       unsigned short src_h, short dst_x, short dst_y,
	       unsigned short dst_w, unsigned short dst_h, int flags)
{
    printf("%s\n", __func__);

    return BadImplementation;
}


/*
 *
 */
_X_EXPORT Status
XvMCHideSurface(Display *display, XvMCSurface *surface)
{
    printf("%s\n", __func__);

    return BadImplementation;
}


/*
 *
 */
_X_EXPORT Status
XvMCCreateSubpicture(Display *display, XvMCContext *context,
		     XvMCSubpicture *subpicture, unsigned short width,
		     unsigned short height, int xvimage_id)
{
    printf("%s\n", __func__);

    return BadImplementation;
}


/*
 *
 */
_X_EXPORT Status
XvMCClearSubpicture(Display *display, XvMCSubpicture *subpicture,
		    short x, short y, unsigned short width,
		    unsigned short height, unsigned int flags)
{
    printf("%s\n", __func__);

    return BadImplementation;
}


/*
 *
 */
_X_EXPORT Status
XvMCCompositeSubpicture(Display *display, XvMCSubpicture *subpicture,
			XvImage *image, short src_x, short src_y,
			unsigned short width, unsigned short height,
			short dst_x, short dst_y)
{
    printf("%s\n", __func__);

    return BadImplementation;
}


/*
 *
 */
_X_EXPORT Status
XvMCDestroySubpicture(Display *display, XvMCSubpicture *subpicture)
{
    printf("%s\n", __func__);

    return Success;
}


/*
 *
 */
_X_EXPORT Status
XvMCSetSubpicturePalette(Display *display, XvMCSubpicture *subpicture,
			 unsigned char *palette)
{
    printf("%s\n", __func__);

    return BadImplementation;
}


/*
 *
 */
_X_EXPORT Status
XvMCBlendSubpicture(Display *display, XvMCSurface *surface,
		    XvMCSubpicture *subpicture, short sub_x, short sub_y,
		    unsigned short sub_width, unsigned short sub_h,
		    short surface_x, short surface_y,
		    unsigned short surface_width, unsigned short surface_h)
{
    printf("%s\n", __func__);

    return BadImplementation;
}


/*
 *
 */
_X_EXPORT Status
XvMCBlendSubpicture2(Display *display, XvMCSurface *source, XvMCSurface *target,
		     XvMCSubpicture *subpicture, short sub_x, short sub_y,
		    unsigned short sub_width, unsigned short sub_h,
		    short surface_x, short surface_y,
		    unsigned short surface_width, unsigned short surface_h)
{
    printf("%s\n", __func__);

    return BadImplementation;
}


/*
 *
 */
_X_EXPORT Status
XvMCSyncSurface(Display *display, XvMCSurface *surface)
{
    printf("%s\n", __func__);

    return BadImplementation;
}


/*
 *
 */
_X_EXPORT Status
XvMCFlushSurface(Display *display, XvMCSurface *surface)
{
    printf("%s\n", __func__);

    return BadImplementation;
}


/*
 *
 */
_X_EXPORT Status
XvMCGetSurfaceStatus(Display *display, XvMCSurface *surface, int *stat)
{
    printf("%s\n", __func__);

    return BadImplementation;
}


/*
 *
 */
_X_EXPORT Status
XvMCRenderSurface(Display *display, XvMCContext *context,
		  unsigned int picture_structure, XvMCSurface *target,
		  XvMCSurface *past, XvMCSurface *future, unsigned int flags,
		  unsigned int num_macroblocks, unsigned int first_macroblock,
		  XvMCMacroBlockArray *macroblock_array, XvMCBlockArray *blocks)
{
    printf("%s\n", __func__);

    return BadImplementation;
}


/*
 *
 */
_X_EXPORT Status
XvMCSyncSubpicture(Display *display, XvMCSubpicture *subpicture)
{
    printf("%s\n", __func__);

    return BadImplementation;
}


/*
 *
 */
_X_EXPORT Status
XvMCFlushSubpicture(Display *display, XvMCSubpicture *subpicture)
{
    printf("%s\n", __func__);

    return BadImplementation;
}


/*
 *
 */
_X_EXPORT Status
XvMCGetSubpictureStatus(Display *display, XvMCSubpicture *subpicture, int *stat)
{
    printf("%s\n", __func__);

    return BadImplementation;
}


/*
 *
 */
_X_EXPORT Status
XvMCCreateBlocks(Display *display, XvMCContext *context,
		 unsigned int num_blocks, XvMCBlockArray *blocks)
{
    printf("%s\n", __func__);

    return BadImplementation;
}


/*
 *
 */
_X_EXPORT Status
XvMCDestroyBlocks(Display *display, XvMCBlockArray *blocks)
{
    printf("%s\n", __func__);

    return Success;
}


/*
 *
 */
_X_EXPORT Status
XvMCCreateMacroBlocks(Display *display, XvMCContext *context,
		      unsigned int num_blocks, XvMCMacroBlockArray *blocks)
{
    printf("%s\n", __func__);

    return BadImplementation;
}


/*
 *
 */
_X_EXPORT Status
XvMCDestroyMacroBlocks(Display *display, XvMCMacroBlockArray *blocks)
{
    printf("%s\n", __func__);

    return Success;
}

/*
 *
 */
_X_EXPORT XvAttribute *
XvMCQueryAttributes(Display *display, XvMCContext *context, int *number)
{
    printf("%s\n", __func__);

    return NULL;
}


/*
 *
 */
_X_EXPORT Status
XvMCSetAttribute(Display *display, XvMCContext *context,
		 Atom Attribute, int value)
{
    printf("%s\n", __func__);

    return BadImplementation;
}


/*
 *
 */
_X_EXPORT Status
XvMCGetAttribute(Display *display, XvMCContext *context,
		 Atom Attribute, int *value)
{
    printf("%s\n", __func__);


}



/*
 *
 */
_X_EXPORT Status
XvMCBeginSurface(Display *display, XvMCContext *context, XvMCSurface *target,
		 XvMCSurface *past, XvMCSurface *future,
		 const XvMCMpegControl *control)
{
    printf("%s\n", __func__);

    return BadImplementation;
}


/*
 *
 */
_X_EXPORT Status
XvMCLoadQMatrix(Display *display, XvMCContext *context,
		const XvMCQMatrix *qmatrix)
{
    printf("%s\n", __func__);

    return BadImplementation;
}


/*
 *
 */
_X_EXPORT Status
XvMCPutSlice(Display *display, XvMCContext *context,
	     char *slice, int size)
{
    printf("%s\n", __func__);

    return BadImplementation;
}


/*
 *
 */
_X_EXPORT Status
XvMCPutSlice2(Display *display, XvMCContext *context,
	      char *slice, int size, int slicecode)
{
    printf("%s\n", __func__);

    return BadImplementation;
}