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
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
|
/*****************************************************************************
* XvMC Wrapper including the Nonstandard VLD extension.
*
* Copyright (c) 2004 The Unichrome project. All rights reserved.
*
*
* 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, sublicense,
* 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 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 NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHOR(S) OR COPYRIGHT HOLDER(S) 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.
*
* Author: Thomas Hellström (2004)
*/
/*
* BUGS: The wrapper really should maintain one symbol table per port.
* This could possibly be implemented. To do that, the port-independent
* symbols need to be lifted out, and one would have to create a number
* of mapping tables:
*
* port -> symbol table
* context -> port
* surface -> port
* subpicture -> port
*
* and reference the right table when needed.
* This needs to be done only if there is a player that wants to access two
* displays with different hardware simultaneously. Not likely as of today.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <X11/Xlib.h>
#include <X11/extensions/XvMC.h>
#include <X11/extensions/XvMClib.h>
#include "X11/extensions/vldXvMC.h"
#include <dlfcn.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <stdlib.h>
typedef Bool (*XvMCQueryExtensionP) (Display *, int *, int *);
typedef Status (*XvMCQueryVersionP) (Display *, int *, int *);
typedef XvMCSurfaceInfo *(*XvMCListSurfaceTypesP) (Display *, XvPortID, int *);
typedef Status (*XvMCCreateContextP) (Display *, XvPortID, int, int, int, int,
XvMCContext *);
typedef Status (*XvMCDestroyContextP) (Display *, XvMCContext *);
typedef Status (*XvMCCreateSurfaceP) (Display *, XvMCContext *, XvMCSurface *);
typedef Status (*XvMCDestroySurfaceP) (Display *, XvMCSurface *);
typedef XvImageFormatValues *(*XvMCListSubpictureTypesP)(Display *, XvPortID,
int, int *);
typedef Status (*XvMCPutSurfaceP) (Display *, XvMCSurface *, Drawable, short,
short, unsigned short, unsigned short, short,
short, unsigned short, unsigned short, int);
typedef Status (*XvMCHideSurfaceP) (Display *, XvMCSurface *);
typedef Status (*XvMCCreateSubpictureP) (Display *, XvMCContext *,
XvMCSubpicture *, unsigned short,
unsigned short, int);
typedef Status (*XvMCClearSubpictureP) (Display *, XvMCSubpicture *, short,
short, unsigned short, unsigned short,
unsigned int);
typedef Status (*XvMCCompositeSubpictureP) (Display *, XvMCSubpicture *,
XvImage *, short, short,
unsigned short, unsigned short,
short, short);
typedef Status (*XvMCDestroySubpictureP) (Display *, XvMCSubpicture *);
typedef Status (*XvMCSetSubpicturePaletteP) (Display *, XvMCSubpicture *,
unsigned char *);
typedef Status (*XvMCBlendSubpictureP) (Display * d, XvMCSurface *,
XvMCSubpicture *, short, short,
unsigned short, unsigned short, short,
short, unsigned short, unsigned short);
typedef Status (*XvMCBlendSubpicture2P) (Display *, XvMCSurface *, XvMCSurface *,
XvMCSubpicture *, short, short,
unsigned short, unsigned short, short,
short, unsigned short, unsigned short);
typedef Status (*XvMCSyncSurfaceP) (Display *, XvMCSurface *);
typedef Status (*XvMCFlushSurfaceP) (Display *, XvMCSurface *);
typedef Status (*XvMCGetSurfaceStatusP) (Display *, XvMCSurface *, int *);
typedef Status (*XvMCRenderSurfaceP) (Display *, XvMCContext *, unsigned int,
XvMCSurface *, XvMCSurface *,
XvMCSurface *, unsigned int, unsigned int,
unsigned int, XvMCMacroBlockArray *,
XvMCBlockArray *);
typedef Status (*XvMCSyncSubpictureP) (Display *, XvMCSubpicture *);
typedef Status (*XvMCFlushSubpictureP) (Display *, XvMCSubpicture *);
typedef Status (*XvMCGetSubpictureStatusP) (Display *, XvMCSubpicture *, int *);
typedef Status (*XvMCCreateBlocksP) (Display *, XvMCContext *, unsigned int,
XvMCBlockArray *);
typedef Status (*XvMCDestroyBlocksP) (Display *, XvMCBlockArray *);
typedef Status (*XvMCCreateMacroBlocksP) (Display *, XvMCContext *, unsigned int,
XvMCMacroBlockArray *);
typedef Status (*XvMCDestroyMacroBlocksP) (Display *, XvMCMacroBlockArray *);
typedef XvAttribute *(*XvMCQueryAttributesP)(Display *, XvMCContext *, int *);
typedef Status (*XvMCSetAttributeP) (Display *, XvMCContext *, Atom, int);
typedef Status (*XvMCGetAttributeP) (Display *, XvMCContext *, Atom, int *);
/*
* Nonstandard VLD acceleration level:
*/
typedef Status (*XvMCBeginSurfaceP) (Display *, XvMCContext *, XvMCSurface *,
XvMCSurface *, XvMCSurface * f,
const XvMCMpegControl *);
typedef Status (*XvMCLoadQMatrixP) (Display *, XvMCContext *,
const XvMCQMatrix *);
typedef Status (*XvMCPutSliceP) (Display *, XvMCContext *, char *, int);
typedef Status (*XvMCPutSlice2P) (Display *, XvMCContext *, char *, int, int);
typedef Status (*XvMCGetDRInfoP) (Display *, XvPortID, char **, char **, int *,
int *, int *, int *);
typedef struct {
XvMCQueryExtensionP XvMCQueryExtension;
XvMCQueryVersionP XvMCQueryVersion;
XvMCListSurfaceTypesP XvMCListSurfaceTypes;
XvMCCreateContextP XvMCCreateContext;
XvMCDestroyContextP XvMCDestroyContext;
XvMCCreateSurfaceP XvMCCreateSurface;
XvMCDestroySurfaceP XvMCDestroySurface;
XvMCListSubpictureTypesP XvMCListSubpictureTypes;
XvMCPutSurfaceP XvMCPutSurface;
XvMCHideSurfaceP XvMCHideSurface;
XvMCCreateSubpictureP XvMCCreateSubpicture;
XvMCClearSubpictureP XvMCClearSubpicture;
XvMCCompositeSubpictureP XvMCCompositeSubpicture;
XvMCDestroySubpictureP XvMCDestroySubpicture;
XvMCSetSubpicturePaletteP XvMCSetSubpicturePalette;
XvMCBlendSubpictureP XvMCBlendSubpicture;
XvMCBlendSubpicture2P XvMCBlendSubpicture2;
XvMCSyncSurfaceP XvMCSyncSurface;
XvMCFlushSurfaceP XvMCFlushSurface;
XvMCGetSurfaceStatusP XvMCGetSurfaceStatus;
XvMCRenderSurfaceP XvMCRenderSurface;
XvMCSyncSubpictureP XvMCSyncSubpicture;
XvMCFlushSubpictureP XvMCFlushSubpicture;
XvMCGetSubpictureStatusP XvMCGetSubpictureStatus;
XvMCCreateBlocksP XvMCCreateBlocks;
XvMCDestroyBlocksP XvMCDestroyBlocks;
XvMCCreateMacroBlocksP XvMCCreateMacroBlocks;
XvMCDestroyMacroBlocksP XvMCDestroyMacroBlocks;
XvMCQueryAttributesP XvMCQueryAttributes;
XvMCSetAttributeP XvMCSetAttribute;
XvMCGetAttributeP XvMCGetAttribute;
/*
* Nonstandard VLD acceleration level:
*/
XvMCBeginSurfaceP XvMCBeginSurface;
XvMCLoadQMatrixP XvMCLoadQMatrix;
XvMCPutSliceP XvMCPutSlice;
XvMCPutSlice2P XvMCPutSlice2;
/*
* Driver name function.
*/
XvMCGetDRInfoP XvMCGetDRInfo;
int preInitialised;
int initialised;
int vldextension;
} XvMCWrapper;
static XvMCWrapper xW;
static int wrapperInit = 0;
static int wrapperPreInit = 0;
static void *xvhandle;
static void *handle2;
#define BUFLEN 200
#define STRS(ARG) STR(ARG)
#define STR(ARG) #ARG
#define XW_RSYM(base,handle,handle2,pointer, retval) \
do { \
register char *symerr; \
base.pointer = (pointer##P) dlsym((handle),#pointer); \
if ((symerr = dlerror()) != NULL) { \
if (!handle2) { \
fprintf(stderr,"%s\n",symerr); return retval; \
} \
base.pointer = (pointer##P) dlsym((handle2),#pointer); \
if ((symerr = dlerror()) != NULL) { \
fprintf(stderr,"%s\n",symerr); return retval; \
} \
} \
} while (0);
#define XW_RSYM2(base,handle,handle2,pointer) \
base.pointer = (pointer##P) dlsym((handle),#pointer); \
if (dlerror() != NULL) { \
base.pointer = (pointer##P) dlsym((handle2),#pointer); \
if (dlerror() != NULL) return; \
}
/*
* Try to dlopen a shared library, versionless first.
*/
static void *
dlopenversion(const char *lib, const char *version, int flag)
{
void *ret;
size_t curLen, verLen;
char *curName;
curLen = strlen(lib) + (verLen = strlen(version)) + 1;
curName = (char *) malloc(curLen * sizeof(char));
strncpy(curName, lib, curLen);
if (verLen > 1) {
const char *tail = strstr(version + 1, ".");
if (NULL != tail) {
strncat(curName, version, (size_t) (tail - version));
}
else {
strncat(curName, version, verLen);
}
}
ret = dlopen(curName, flag);
free(curName);
return ret;
}
static int
preInitW(Display *dpy)
{
/*
* Resolve functions that are not hw driver specific.
*/
void *handleZ = NULL;
wrapperPreInit = 1;
xW.preInitialised = 0;
xW.initialised = 0;
xvhandle = dlopenversion("libXv.so", XV_SOVERSION, RTLD_LAZY | RTLD_GLOBAL);
if (!xvhandle) {
fprintf(stderr, "XvMCWrapper: Warning! Could not open shared "
"library \"libXv.so" XV_SOVERSION
"\"\nThis may cause relocation "
"errors later.\nError was: \"%s\".\n", dlerror());
}
handle2 =
dlopenversion("libXvMC.so", XVMC_SOVERSION, RTLD_LAZY | RTLD_GLOBAL);
if (!handle2) {
fprintf(stderr, "XvMCWrapper: Could not load XvMC "
"library \"libXvMC.so" XVMC_SOVERSION "\". Failing\n");
fprintf(stderr, "%s\n", dlerror());
return 1;
}
XW_RSYM(xW, handle2, handleZ, XvMCQueryExtension, 1);
XW_RSYM(xW, handle2, handleZ, XvMCQueryVersion, 1);
xW.preInitialised = 1;
return 0;
}
static void
initW(Display *dpy, XvPortID port)
{
char nameBuffer[BUFLEN];
void *handle;
char *clientName = NULL;
char *err;
size_t nameLen = 0;
wrapperInit = 1;
xW.initialised = 0;
if (!wrapperPreInit)
if (preInitW(dpy))
return;
/*
* Will the DDX tell us the client driver name?
*/
xW.XvMCGetDRInfo = (XvMCGetDRInfoP)
dlsym(handle2, "XvMCGetDRInfo");
if ((err = dlerror()) == NULL) {
int major, minor, patchLevel, isLocal;
char *busID = NULL;
if (0 == xW.XvMCGetDRInfo(dpy, port, &clientName, &busID, &major,
&minor, &patchLevel, &isLocal)) {
nameLen = strlen(clientName);
XFree(busID);
if (!isLocal) {
fprintf(stderr,
"XvMCWrapper: X server is not local. Cannot run XvMC.\n");
XFree(clientName);
return;
}
}
else {
clientName = NULL;
}
}
if (clientName && (nameLen < BUFLEN - 7) && (nameLen > 0)) {
nameLen += 3;
strncpy(nameBuffer, "lib", BUFLEN - 1);
strncpy(nameBuffer + 3, clientName, BUFLEN - 4);
strncpy(nameBuffer + nameLen, ".so", BUFLEN - nameLen - 1);
nameBuffer[BUFLEN - 1] = 0;
XFree(clientName);
handle = dlopenversion(nameBuffer, XVMC_SOVERSION, RTLD_LAZY);
}
else {
/*
* No. Try to obtain it from the config file.
*/
size_t tmp;
FILE *configFile;
if (clientName)
XFree(clientName);
configFile = fopen(STRS(XVMC_CONFIGDIR) "/XvMCConfig", "r");
xW.initialised = 0;
xW.vldextension = 0;
if (NULL == configFile) {
fprintf(stderr, "XvMCWrapper: Could not open config file \"%s\".\n",
STRS(XVMC_CONFIGDIR) "/XvMCConfig");
perror("XvMCWrapper");
return;
}
if (NULL == fgets(nameBuffer, BUFLEN, configFile)) {
fclose(configFile);
fprintf(stderr, "XvMCWrapper: Could not read XvMC library name.\n");
perror("XvMCWrapper");
return;
}
fclose(configFile);
if ((tmp = strlen(nameBuffer)) == 0) {
fprintf(stderr, "XvMCWrapper: Zero length XvMC library name.\n");
fprintf(stderr, "%s\n", dlerror());
return;
}
/*
* Skip trailing newlines and garbage.
*/
while (iscntrl(nameBuffer[tmp - 1])) {
nameBuffer[tmp - 1] = 0;
if (--tmp == 0) {
fprintf(stderr,
"XvMCWrapper: Zero length XvMC library name.\n");
return;
}
}
handle = dlopen(nameBuffer, RTLD_LAZY);
}
if (!handle) {
fprintf(stderr, "XvMCWrapper: Could not load hardware specific XvMC "
"library \"%s\".\n", nameBuffer);
fprintf(stderr, "%s\n", dlerror());
return;
}
XW_RSYM(xW, handle, handle2, XvMCListSurfaceTypes,);
XW_RSYM(xW, handle, handle2, XvMCCreateContext,);
XW_RSYM(xW, handle, handle2, XvMCDestroyContext,);
XW_RSYM(xW, handle, handle2, XvMCCreateSurface,);
XW_RSYM(xW, handle, handle2, XvMCDestroySurface,);
XW_RSYM(xW, handle, handle2, XvMCListSubpictureTypes,);
XW_RSYM(xW, handle, handle2, XvMCHideSurface,);
XW_RSYM(xW, handle, handle2, XvMCCreateSubpicture,);
XW_RSYM(xW, handle, handle2, XvMCClearSubpicture,);
XW_RSYM(xW, handle, handle2, XvMCCompositeSubpicture,);
XW_RSYM(xW, handle, handle2, XvMCDestroySubpicture,);
XW_RSYM(xW, handle, handle2, XvMCSetSubpicturePalette,);
XW_RSYM(xW, handle, handle2, XvMCBlendSubpicture,);
XW_RSYM(xW, handle, handle2, XvMCBlendSubpicture2,);
XW_RSYM(xW, handle, handle2, XvMCPutSurface,);
XW_RSYM(xW, handle, handle2, XvMCSyncSurface,);
XW_RSYM(xW, handle, handle2, XvMCFlushSurface,);
XW_RSYM(xW, handle, handle2, XvMCGetSurfaceStatus,);
XW_RSYM(xW, handle, handle2, XvMCRenderSurface,);
XW_RSYM(xW, handle, handle2, XvMCSyncSubpicture,);
XW_RSYM(xW, handle, handle2, XvMCFlushSubpicture,);
XW_RSYM(xW, handle, handle2, XvMCGetSubpictureStatus,);
XW_RSYM(xW, handle, handle2, XvMCCreateBlocks,);
XW_RSYM(xW, handle, handle2, XvMCDestroyBlocks,);
XW_RSYM(xW, handle, handle2, XvMCCreateMacroBlocks,);
XW_RSYM(xW, handle, handle2, XvMCDestroyMacroBlocks,);
XW_RSYM(xW, handle, handle2, XvMCQueryAttributes,);
XW_RSYM(xW, handle, handle2, XvMCSetAttribute,);
XW_RSYM(xW, handle, handle2, XvMCGetAttribute,);
xW.initialised = 1;
XW_RSYM2(xW, handle, handle2, XvMCBeginSurface);
XW_RSYM(xW, handle, handle2, XvMCLoadQMatrix,);
XW_RSYM(xW, handle, handle2, XvMCPutSlice,);
XW_RSYM(xW, handle, handle2, XvMCPutSlice2,);
xW.vldextension = 1;
}
Bool
XvMCQueryExtension(Display *display, int *eventBase, int *errBase)
{
if (!wrapperPreInit)
preInitW(display);
if (!xW.preInitialised)
return 0;
return (*xW.XvMCQueryExtension) (display, eventBase, errBase);
}
Status
XvMCQueryVersion(Display *display, int *major_versionp, int *minor_versionp)
{
if (!wrapperPreInit)
preInitW(display);
if (!xW.preInitialised)
return 0;
return (*xW.XvMCQueryVersion) (display, major_versionp, minor_versionp);
}
XvMCSurfaceInfo *
XvMCListSurfaceTypes(Display *dpy, XvPortID port, int *num)
{
if (!wrapperInit)
initW(dpy, port);
if (!xW.initialised)
return NULL;
return (*xW.XvMCListSurfaceTypes) (dpy, port, num);
}
Status
XvMCCreateContext(Display *display,
XvPortID port,
int surface_type_id,
int width,
int height,
int flags,
XvMCContext *context)
{
if (!wrapperInit)
initW(display, port);
if (!xW.initialised)
return BadValue;
return (*xW.XvMCCreateContext) (display, port, surface_type_id,
width, height, flags, context);
}
Status
XvMCDestroyContext(Display *display, XvMCContext *context)
{
if (!xW.initialised)
return BadValue;
return (*xW.XvMCDestroyContext) (display, context);
}
Status
XvMCCreateSurface(Display *display,
XvMCContext *context,
XvMCSurface *surface)
{
if (!xW.initialised)
return BadValue;
return (*xW.XvMCCreateSurface) (display, context, surface);
}
Status
XvMCDestroySurface(Display *display, XvMCSurface *surface)
{
if (!xW.initialised)
return BadValue;
return (*xW.XvMCDestroySurface) (display, surface);
}
XvImageFormatValues *
XvMCListSubpictureTypes(Display *display,
XvPortID port,
int surface_type_id,
int *count_return)
{
if (!xW.initialised)
return NULL;
return (*xW.XvMCListSubpictureTypes) (display, port, surface_type_id,
count_return);
}
Status
XvMCPutSurface(Display *display,
XvMCSurface * surface,
Drawable draw,
short srcx,
short srcy,
unsigned short srcw,
unsigned short srch,
short destx,
short desty,
unsigned short destw,
unsigned short desth,
int flags)
{
if (!xW.initialised)
return BadValue;
return (*xW.XvMCPutSurface) (display, surface, draw, srcx, srcy, srcw, srch,
destx, desty, destw, desth, flags);
}
Status
XvMCHideSurface(Display *display, XvMCSurface *surface)
{
if (!xW.initialised)
return BadValue;
return (*xW.XvMCHideSurface) (display, surface);
}
Status
XvMCCreateSubpicture(Display *display,
XvMCContext *context,
XvMCSubpicture *subpicture,
unsigned short width,
unsigned short height,
int xvimage_id)
{
if (!xW.initialised)
return BadValue;
return (*xW.XvMCCreateSubpicture) (display, context, subpicture, width,
height, xvimage_id);
}
Status
XvMCClearSubpicture(Display *display,
XvMCSubpicture *subpicture,
short x,
short y,
unsigned short width,
unsigned short height,
unsigned int color)
{
if (!xW.initialised)
return BadValue;
return (*xW.XvMCClearSubpicture) (display, subpicture, x, y, width, height,
color);
}
Status
XvMCCompositeSubpicture(Display *display,
XvMCSubpicture *subpicture,
XvImage *image,
short srcx,
short srcy,
unsigned short width,
unsigned short height,
short dstx,
short dsty)
{
if (!xW.initialised)
return BadValue;
return (*xW.XvMCCompositeSubpicture) (display, subpicture, image, srcx,
srcy, width, height, dstx, dsty);
}
Status
XvMCDestroySubpicture(Display *display, XvMCSubpicture *subpicture)
{
if (!xW.initialised)
return BadValue;
return (*xW.XvMCDestroySubpicture) (display, subpicture);
}
Status
XvMCSetSubpicturePalette(Display *display,
XvMCSubpicture *subpicture,
unsigned char *palette)
{
if (!xW.initialised)
return BadValue;
return (*xW.XvMCSetSubpicturePalette) (display, subpicture, palette);
}
Status
XvMCBlendSubpicture(Display *display,
XvMCSurface *target_surface,
XvMCSubpicture *subpicture,
short subx,
short suby,
unsigned short subw,
unsigned short subh,
short surfx,
short surfy,
unsigned short surfw,
unsigned short surfh)
{
if (!xW.initialised)
return BadValue;
return (*xW.XvMCBlendSubpicture) (display, target_surface, subpicture,
subx, suby, subw, subh, surfx, surfy,
surfw, surfh);
}
Status
XvMCBlendSubpicture2(Display *display,
XvMCSurface *source_surface,
XvMCSurface *target_surface,
XvMCSubpicture *subpicture,
short subx,
short suby,
unsigned short subw,
unsigned short subh,
short surfx,
short surfy,
unsigned short surfw,
unsigned short surfh)
{
if (!xW.initialised)
return BadValue;
return (*xW.XvMCBlendSubpicture2) (display, source_surface, target_surface,
subpicture, subx, suby, subw, subh,
surfx, surfy, surfw, surfh);
}
Status
XvMCSyncSurface(Display *display, XvMCSurface *surface)
{
if (!xW.initialised)
return BadValue;
return (*xW.XvMCSyncSurface) (display, surface);
}
Status
XvMCFlushSurface(Display *display, XvMCSurface *surface)
{
if (!xW.initialised)
return BadValue;
return (*xW.XvMCFlushSurface) (display, surface);
}
Status
XvMCGetSurfaceStatus(Display *display, XvMCSurface *surface, int *stat)
{
if (!xW.initialised)
return BadValue;
return (*xW.XvMCGetSurfaceStatus) (display, surface, stat);
}
Status
XvMCRenderSurface(Display *display,
XvMCContext *context,
unsigned int picture_structure,
XvMCSurface *target_surface,
XvMCSurface *past_surface,
XvMCSurface *future_surface,
unsigned int flags,
unsigned int num_macroblocks,
unsigned int first_macroblock,
XvMCMacroBlockArray *macroblock_array,
XvMCBlockArray *blocks)
{
if (!xW.initialised)
return BadValue;
return (*xW.XvMCRenderSurface) (display, context, picture_structure,
target_surface, past_surface,
future_surface, flags, num_macroblocks,
first_macroblock, macroblock_array, blocks);
}
Status
XvMCSyncSubpicture(Display *display, XvMCSubpicture *subpicture)
{
if (!xW.initialised)
return BadValue;
return (*xW.XvMCSyncSubpicture) (display, subpicture);
}
Status
XvMCFlushSubpicture(Display *display, XvMCSubpicture *subpicture)
{
if (!xW.initialised)
return BadValue;
return (*xW.XvMCFlushSubpicture) (display, subpicture);
}
Status
XvMCGetSubpictureStatus(Display *display, XvMCSubpicture *subpic, int *stat)
{
if (!xW.initialised)
return BadValue;
return (*xW.XvMCGetSubpictureStatus) (display, subpic, stat);
}
Status
XvMCCreateBlocks(Display *display,
XvMCContext *context,
unsigned int num_blocks,
XvMCBlockArray *block)
{
if (!xW.initialised)
return BadValue;
return (*xW.XvMCCreateBlocks) (display, context, num_blocks, block);
}
Status
XvMCDestroyBlocks(Display *display, XvMCBlockArray *block)
{
if (!xW.initialised)
return BadValue;
return (*xW.XvMCDestroyBlocks) (display, block);
}
Status
XvMCCreateMacroBlocks(Display *display,
XvMCContext *context,
unsigned int num_blocks,
XvMCMacroBlockArray *blocks)
{
if (!xW.initialised)
return BadValue;
return (*xW.XvMCCreateMacroBlocks) (display, context, num_blocks, blocks);
}
Status
XvMCDestroyMacroBlocks(Display *display,
XvMCMacroBlockArray *block)
{
if (!xW.initialised)
return BadValue;
return (*xW.XvMCDestroyMacroBlocks) (display, block);
}
XvAttribute *
XvMCQueryAttributes(Display *display,
XvMCContext *context,
int *number)
{
if (!xW.initialised)
return NULL;
return (*xW.XvMCQueryAttributes) (display, context, number);
}
Status
XvMCSetAttribute(Display *display,
XvMCContext *context,
Atom attribute,
int value)
{
if (!xW.initialised)
return BadValue;
return (*xW.XvMCSetAttribute) (display, context, attribute, value);
}
Status
XvMCGetAttribute(Display *display,
XvMCContext *context,
Atom attribute,
int *value)
{
if (!xW.initialised)
return BadValue;
return (*xW.XvMCGetAttribute) (display, context, attribute, value);
}
Status
XvMCBeginSurface(Display *display,
XvMCContext *context,
XvMCSurface *target_surface,
XvMCSurface *past_surface,
XvMCSurface *future_surface,
const XvMCMpegControl *control)
{
if (!xW.vldextension)
return BadValue;
return (*xW.XvMCBeginSurface) (display, context, target_surface,
past_surface, future_surface, control);
}
Status
XvMCLoadQMatrix(Display *display, XvMCContext *context,
const XvMCQMatrix *qmx)
{
if (!xW.vldextension)
return BadValue;
return (*xW.XvMCLoadQMatrix) (display, context, qmx);
}
Status
XvMCPutSlice(Display *display, XvMCContext *context, char *slice, int nBytes)
{
if (!xW.vldextension)
return BadValue;
return (*xW.XvMCPutSlice) (display, context, slice, nBytes);
}
Status
XvMCPutSlice2(Display *display, XvMCContext *context,
char *slice, int nBytes, int sliceCode)
{
if (!xW.vldextension)
return BadValue;
return (*xW.XvMCPutSlice2) (display, context, slice, nBytes, sliceCode);
}
|