summaryrefslogtreecommitdiffstats
path: root/src/xvmc/subpicture.c
blob: c8f70c90d0c09f96aa5c2c511855f27e1d6799fd (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
#include <assert.h>
#include <X11/Xlib.h>
#include <X11/extensions/Xvlib.h>
#include <X11/extensions/XvMC.h>

Status XvMCCreateSubpicture
(
	Display *display,
	XvMCContext *context,
	XvMCSubpicture *subpicture,
	unsigned short width,
	unsigned short height,
	int xvimage_id
)
{
	assert(display);
	
	if (!context)
		return XvMCBadContext;
	
	assert(subpicture);
	
	if (width > 2048 || height > 2048)
		return BadValue;
	
	if (xvimage_id != 123)
		return BadMatch;
	
	subpicture->subpicture_id = XAllocID(display);
	subpicture->context_id = context->context_id;
	subpicture->xvimage_id = xvimage_id;
	subpicture->width = width;
	subpicture->height = height;
	subpicture->num_palette_entries = 0;
	subpicture->entry_bytes = 0;
	subpicture->component_order[0] = 0;
	subpicture->component_order[1] = 0;
	subpicture->component_order[2] = 0;
	subpicture->component_order[3] = 0;
	/* TODO: subpicture->privData = ;*/
	
	return Success;
}

Status XvMCClearSubpicture
(
	Display *display,
	XvMCSubpicture *subpicture,
	short x,
	short y,
	unsigned short width,
	unsigned short height,
	unsigned int color
)
{
	assert(display);
	
	if (!subpicture)
		return XvMCBadSubpicture;
	
	/* TODO: Assert clear rect is within bounds? Or clip? */
	
	return Success;
}

Status XvMCCompositeSubpicture
(
	Display *display,
	XvMCSubpicture *subpicture,
	XvImage *image,
	short srcx,
	short srcy,
	unsigned short width,
	unsigned short height,
	short dstx,
	short dsty
)
{
	assert(display);
	
	if (!subpicture)
		return XvMCBadSubpicture;
	
	assert(image);
	
	if (subpicture->xvimage_id != image->id)
		return BadMatch;
	
	/* TODO: Assert rects are within bounds? Or clip? */
	
	return Success;
}

Status XvMCDestroySubpicture(Display *display, XvMCSubpicture *subpicture)
{
	assert(display);
	
	if (!subpicture)
		return XvMCBadSubpicture;
	
	return BadImplementation;
}

Status XvMCSetSubpicturePalette(Display *display, XvMCSubpicture *subpicture, unsigned char *palette)
{
	assert(display);
	
	if (!subpicture)
		return XvMCBadSubpicture;
	
	assert(palette);
	
	/* We don't support paletted subpictures */
	return BadMatch;
}

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
)
{
	assert(display);
	
	if (!target_surface)
		return XvMCBadSurface;
	
	if (!subpicture)
		return XvMCBadSubpicture;
	
	if (target_surface->context_id != subpicture->context_id)
		return BadMatch;
	
	/* TODO: Assert rects are within bounds? Or clip? */
	return Success;
}

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
)
{
	assert(display);
	
	if (!source_surface || !target_surface)
		return XvMCBadSurface;
	
	if (!subpicture)
		return XvMCBadSubpicture;
	
	if (source_surface->context_id != subpicture->context_id)
		return BadMatch;
		
	if (source_surface->context_id != subpicture->context_id)
		return BadMatch;
	
	/* TODO: Assert rects are within bounds? Or clip? */
	return Success;
}

Status XvMCSyncSubpicture(Display *display, XvMCSubpicture *subpicture)
{
	assert(display);
	
	if (!subpicture)
		return XvMCBadSubpicture;
	
	return Success;
}

Status XvMCFlushSubpicture(Display *display, XvMCSubpicture *subpicture)
{
	assert(display);
	
	if (!subpicture)
		return XvMCBadSubpicture;
	
	return Success;
}

Status XvMCGetSubpictureStatus(Display *display, XvMCSubpicture *subpicture, int *status)
{
	assert(display);
	
	if (!subpicture)
		return XvMCBadSubpicture;
	
	assert(status);
	
	/* TODO */
	*status = 0;
	
	return Success;
}